What does UsbPt104Enumerate return?

Post your C and C++ discussions here
Post Reply
Posts: 0
Joined: Tue Sep 17, 2013 2:49 pm

What does UsbPt104Enumerate return?

Post by chris660 » Tue Sep 17, 2013 3:11 pm

One of the outputs of the UsbPt104Enumerate() funtion: char *details", is defined in the programming manual as:
details, a string buffer to receive a maximum of length characters
Unfortunately the manual doesn't define the format of the data that will be written to the buffer provided, just that the function outputs:
a list of all the attached PT-104 devices of the specified port type
Presumably this will be a list of device serial numbers (that can then be passed to UsbPt104OpenUnit() to open a device), but how is the list delimited? What's the output if there are no connected devices (empty string?)?

Can anyone help with answers to these questions?

Thanks, Chris.

Posts: 2855
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: What does UsbPt104Enumerate return?

Post by Hitesh » Mon Sep 23, 2013 11:35 am

Hi Chris,

If I include the following bits of code in the main function of the Console Example just for USB devices:

Code: Select all

char details[100] = {NULL};
unsigned long length = 0;

/* Other bits of code */

		status = UsbPt104Enumerate(&details[0], &length, CT_USB);

		printf("Units: %s\n", details);
		printf("Serial Length: %d\n", length);

                /* Proceed to attempt to open unit */
I get the following:
  • With 0 units connected:

    Serial Length: 0
    Unable to open device. Status code: 0x3
  • With 1 unit connected:

    Units: USB:AY429/085
    Serial Length: 14
    USB PT-104 Opened.
The string returned will be null terminated i.e. with '\0'

I hope this helps.

Software Dev. Engineer

Post Reply