Yes, I am doing a loop, but I only do libusb_open
and libusb_get_string_descriptor_ascii when VId & pID matches.:

if (desc->idProduct==pid && desc->idVendor==vid)
{
printf("Before call libusb_open\n");
r=libusb_open(dev,&m_handle );
printf("Before call libusb_get_string_descriptor_ascii\n");
//r=libusb_claim_interface(m_handle,0);
unsigned char sSerial[256];
r=libusb_get_string_descriptor_ascii( m_handle, 3, sSerial, 255 );
const char* error = libusb_error_name(r);
return dev;
}

On Mon, Jul 16, 2012 at 7:58 AM, John Chen <john...@gmail.com> wrote:

>
> Peter,
> Here is what I have:
> I am statically linked to libusb-1.0.lib ,
> The legacy app is using  _DeviceIoControl   to get the serial number, the
> error code returned from libusb_get_string_descriptor_ascii is 0xfffffffb,
>  return from libusb_error_name is  "LIBUSB_ERROR_NOT_FOUND", that is a
> Libusb specific error.
>
> Thx
>
>
>
> On Mon, Jul 16, 2012 at 4:00 AM, Peter Stuge <pe...@stuge.se> wrote:
>
>> John Chen wrote:
>> > I am using libusb-1.0.9, under windows 7
>>
>> Just a note that the debug log you sent is from libusbx, so check
>> which DLL gets used if you intended something else.
>>
>
>
>
>
>>
>>
>> > I am also able to get serial # from one of our legacy app (written
>> > with windows API)
>>
>> Note that retrieving a string descriptor is a generic USB-level
>> operation and that can't really involve unrelated Windows API.
>> The serial number is just one many uses for string descriptors.
>>
>> That said, which windows API do you use to retrieve the serial
>> number?
>>
>>
>> > *Before call libusb_get_string_descriptor_ascii*
>> > [ 0.350070] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 0
>> > [ 0.352070] [0000181c] libusbx: error [winusb_claim_interface] could
>> not access interface 0: [1] Incorrect function.
>>
>> Microsoft doesn't document what ERROR_INVALID_FUNCTION means when
>> calling WinUsb_Initialize() - if the error code is indeed from that
>> call and not from Windows in general.
>>
>> > [ 0.353571] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 1
>> > [ 0.355571] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 2
>> > [ 0.357572] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 3
>> > [ 0.359572] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 4
>> > [ 0.362072] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 5
>> > [ 0.365573] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 6
>> > [ 0.367574] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 7
>> > [ 0.369574] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 8
>> > [ 0.371574] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 9
>> > [ 0.374075] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 10
>> > [ 0.376075] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 11
>> > [ 0.378076] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 12
>> > [ 0.380076] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 13
>> > [ 0.382076] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 14
>> > [ 0.384577] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 15
>> > [ 0.386577] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 16
>> > [ 0.388578] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 17
>> > [ 0.390578] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 18
>> > [ 0.393079] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 19
>> > [ 0.395079] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 20
>> > [ 0.398580] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 21
>> > [ 0.400580] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 22
>> > [ 0.403081] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 23
>> > [ 0.405081] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 24
>> > [ 0.407081] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 25
>> > [ 0.409082] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 26
>> > [ 0.411082] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 27
>> > [ 0.413083] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 28
>> > [ 0.415083] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 29
>> > [ 0.417584] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 30
>> > [ 0.419584] [0000181c] libusbx: debug [libusb_claim_interface]
>> interface 31
>>
>> It seems that you are calling libusb_claim_interface() in a loop. Just
>> call it one time for the interface that you actually want to use.
>>
>>
>> > Interface Descriptor:
>> > bInterfaceNumber:     0x00
>> > bAlternateSetting:    0x00
>> > bNumEndpoints:        0x05
>> > bInterfaceClass:      0xFF
>> > bInterfaceSubClass:   0xFF
>> > bInterfaceProtocol:   0xFF
>> > iInterface:           0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x01  OUT
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0040 (64)
>> > bInterval:            0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x02  OUT
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x04  OUT
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x86  IN
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x88  IN
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>> >
>> > Interface Descriptor:
>> > bInterfaceNumber:     0x00
>> > bAlternateSetting:    0x01
>> > bNumEndpoints:        0x03
>> > bInterfaceClass:      0xFF
>> > bInterfaceSubClass:   0xFF
>> > bInterfaceProtocol:   0xFF
>> > iInterface:           0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x02  OUT
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x86  IN
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>> >
>> > Endpoint Descriptor:
>> > bEndpointAddress:     0x88  IN
>> > Transfer Type:        Bulk
>> > wMaxPacketSize:     0x0200 (512)
>> > bInterval:            0x00
>>
>> There seems to be one interface in this device, but with two
>> altsettings. Interesting that altsettings are used without isoc
>> endpoints, but not disallowed.
>>
>>
>> //Peter
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> libusbx-devel mailing list
>> libusbx-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/libusbx-devel
>>
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to