mbr-icelantern | 1 Nov 2011 13:37

Error during enumeration under Centos 5.7

Hi,

We are using libusb 0.1.12-5.1 running on Centos 5.7 linux. We are using 
a pretty standard initialisation which has worked on other systems like 
Ubuntu and Federa. The opening of the devide is attached at the end of 
the mail. However in the case of Centos then we get some errors like 
that shown below. Does anyone know what these mean?

Kind regards
Mark

---- Error log ----

usb_set_debug: Setting debugging level to 255 (on)
usb_os_init: Found USB VFS at /dev/bus/usb
usb_os_find_busses: Found 008
usb_os_find_busses: Found 007
usb_os_find_busses: Found 006
usb_os_find_busses: Found 001
usb_os_find_busses: Found 002
usb_os_find_busses: Found 005
usb_os_find_busses: Found 003
usb_os_find_busses: Found 004
usb_os_find_devices: Found 001 on 008
usb_os_find_devices: Found 001 on 007
usb_os_find_devices: Found 001 on 006
usb_os_find_devices: Found 001 on 001
usb_os_find_devices: Found 016 on 002
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
(Continue reading)

Xiaofan Chen | 1 Nov 2011 14:42
Picon

Re: Error during enumeration under Centos 5.7

On Tue, Nov 1, 2011 at 8:37 PM, mbr-icelantern <mbr <at> icelantern.com> wrote:
> Hi,
>
> We are using libusb 0.1.12-5.1 running on Centos 5.7 linux. We are using
> a pretty standard initialisation which has worked on other systems like
> Ubuntu and Federa. The opening of the devide is attached at the end of
> the mail. However in the case of Centos then we get some errors like
> that shown below. Does anyone know what these mean?
>
> Kind regards
> Mark
>
>
> ---- Error log ----
>
> usb_set_debug: Setting debugging level to 255 (on)
> usb_os_init: Found USB VFS at /dev/bus/usb
> usb_os_find_busses: Found 008
> usb_os_find_busses: Found 007
> usb_os_find_busses: Found 006
> usb_os_find_busses: Found 001
> usb_os_find_busses: Found 002
> usb_os_find_busses: Found 005
> usb_os_find_busses: Found 003
> usb_os_find_busses: Found 004
> usb_os_find_devices: Found 001 on 008
> usb_os_find_devices: Found 001 on 007
> usb_os_find_devices: Found 001 on 006
> usb_os_find_devices: Found 001 on 001
> usb_os_find_devices: Found 016 on 002
(Continue reading)

mbr-icelantern | 1 Nov 2011 15:02

Re: Error during enumeration under Centos 5.7

Thanks Xiaofan,

Well our device under these situations fails to open - that is our 
OpenDevice() function returns false. I just assumed that it has 
something to do with the following lines....

error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device

What do these mean? Is this an error situation encountered because 
libusb doesnt like the USB device? We though that because of these the 
OpenDevice() returns false.

We will explore exactly where in the function we branch too....

Kind Regards,
Mark

On 01-11-2011 14:42, Xiaofan Chen wrote:
> On Tue, Nov 1, 2011 at 8:37 PM, mbr-icelantern<mbr <at> icelantern.com>  wrote:
>> Hi,
>>
>> We are using libusb 0.1.12-5.1 running on Centos 5.7 linux. We are using
>> a pretty standard initialisation which has worked on other systems like
>> Ubuntu and Federa. The opening of the devide is attached at the end of
>> the mail. However in the case of Centos then we get some errors like
>> that shown below. Does anyone know what these mean?
>>
>> Kind regards
>> Mark
(Continue reading)

Xiaofan Chen | 1 Nov 2011 15:15
Picon

Re: Error during enumeration under Centos 5.7

On Tue, Nov 1, 2011 at 10:02 PM, mbr-icelantern <mbr <at> icelantern.com> wrote:
> Thanks Xiaofan,
>
> Well our device under these situations fails to open - that is our
> OpenDevice() function returns false. I just assumed that it has something to
> do with the following lines....
>
> error obtaining child information: Inappropriate ioctl for device
> error obtaining child information: Inappropriate ioctl for device

I believe this is just internal debug message of libusb-0.1 and it
should not be an error. On the other hand, libusb-0.1 is not
maintained any more so nobody will bother to fix the above.

> What do these mean? Is this an error situation encountered because libusb
> doesnt like the USB device? We though that because of these the OpenDevice()
> returns false.

No, the above is not the real issue.

> We will explore exactly where in the function we branch too....

You may want to check if "lsusb -vvv" can see your device.

--

-- 
Xiaofan

------------------------------------------------------------------------------
RSA&reg; Conference 2012
Save &#36;700 by Nov 18
(Continue reading)

Maya Erez | 3 Nov 2011 14:01

[RFC/PATCH v2 1/2] Add 32-bit word parsing in usbi_parse_descriptor

Signed-off-by: Maya Erez <merez <at> codeaurora.com>
--
diff --git a/libusb/descriptor.c b/libusb/descriptor.c
index 11480e8..ecaa060 100644
--- a/libusb/descriptor.c
+++ b/libusb/descriptor.c
 <at>  <at>  -45,6 +45,7  <at>  <at>  int usbi_parse_descriptor(unsigned char *source, const char *descriptor,
 	unsigned char *sp = source, *dp = dest;
 	uint16_t w;
 	const char *cp;
+	uint32_t d;

 	for (cp = descriptor; *cp; cp++) {
 		switch (*cp) {
 <at>  <at>  -63,6 +64,21  <at>  <at>  int usbi_parse_descriptor(unsigned char *source, const char *descriptor,
 				sp += 2;
 				dp += 2;
 				break;
+			/* 32-bit word, convert from little endian to CPU */
+			case 'd':
+			/* Align to word boundary */
+				dp += ((unsigned long)dp & 1);
+
+				if (host_endian) {
+					memcpy(dp, sp, 4);
+				} else {
+					d = (sp[3] << 24) | (sp[2] << 16) |
+						(sp[1] << 8) | sp[0];
+					*((uint32_t *)dp) = d;
+				}
(Continue reading)

Maya Erez | 3 Nov 2011 14:00

[RFC/PATCH v2 0/2] *** Add SuperSpeed descriptors support ***

Support parsing of Endpoint companion descriptor and BOS descriptor
USB3 descriptors

Maya Erez (2):
  Add 32-bit word parsing in usbi_parse_descriptor
  Add support to USB3 descriptors

 libusb/descriptor.c |  214 +++++++++++++++++++++++++++++++++++++++++++++++++--
 libusb/libusb.h     |  148 +++++++++++++++++++++++++++++++++++-
 2 files changed, 354 insertions(+), 8 deletions(-)

--
1.7.3.3
--
Seny by a Consultant for Qualcomm innovation center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
Maya Erez | 3 Nov 2011 14:02

[RFC/PATCH v2 2/2] Add support to USB3 descriptors

    - Add definitions for Endpoint Companion and BOS descriptors.
    - Add APIs for parsing the Endpoint Companion and BOS descriptors.

Signed-off-by: Maya Erez <merez <at> codeaurora.com>
--
diff --git a/libusb/descriptor.c b/libusb/descriptor.c
index ecaa060..f3c341a 100644
--- a/libusb/descriptor.c
+++ b/libusb/descriptor.c
 <at>  <at>  -89,6 +89,40  <at>  <at>  static void clear_endpoint(struct libusb_endpoint_descriptor *endpoint)
 {
 	if (endpoint->extra)
 		free((unsigned char *) endpoint->extra);
+	if (endpoint->ep_comp)
+		free((unsigned char *) endpoint->ep_comp);
+}
+
+static int parse_endpoint_companion(struct libusb_context *ctx,
+			       struct libusb_ss_endpoint_companion_descriptor *ep_comp,
+			       unsigned char *buffer, int size)
+{
+	struct usb_descriptor_header header;
+	int parsed = 0;
+
+	usbi_parse_descriptor(buffer, "bb", &header, 0);
+
+	/* Everything should be fine being passed into here, but we sanity */
+	/*  check JIC */
+	if (header.bLength > size) {
+		usbi_err(ctx, "ran out of descriptors parsing");
(Continue reading)

Segher Boessenkool | 3 Nov 2011 22:37

Re: [RFC/PATCH v2 1/2] Add 32-bit word parsing in usbi_parse_descriptor

> +			/* Align to word boundary */
> +				dp += ((unsigned long)dp & 1);

That really doesn't fly, this is totally non-portable.  It's best
if whatever calls this code does the alignment; if you cannot do
that, at least split it to some helper function that you can decorate
with big "THERE IS EVILNESS INSIDE THIS" markers.

> +
> +				if (host_endian) {
> +					memcpy(dp, sp, 4);
> +				} else {
> +					d = (sp[3] << 24) | (sp[2] << 16) |
> +						(sp[1] << 8) | sp[0];
> +					*((uint32_t *)dp) = d;
> +				}

That's a probable aliasing violation.  Also, dp isn't properly aligned
for a 32-bit access.

Segher

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
Justin Knotzke | 6 Nov 2011 18:05
Picon
Gravatar

Timeouts on OSX


  Hi

I am having some issues with libusb and OSX 10.7.2.

I am having nearly the same issues using standard IOKit so I do not think this is a libusb issue. But maybe someone can help me.

I have a USB stick that does not use a driver of any sort. I am able to read and write off this stick without issue. The issue arises when I close down the device and the application and restart. libusb finds the device appears to open it and then throws a series of timeout errors. Here is how I am closing down the devices:

 if (usb_device) {
        rc = usb_release_interface(usb_device, readEndpoint);
        rc = usb_release_interface(usb_device, writeEndpoint);
        rc = usb_close(usb_device);
    }


This returns without error..

Here is how the debug looks (I've taken out redundant messages to reduce the size of this email).


The last message seen when closing down the application:

usb_os_close: 05ac:8006



The re-start of the application:


Found a the USB stick !

usb_os_open: 0fcf:1008
usb_set_configuration: called for config 1
usb_claim_interface: called for interface 0
Interface 0 of device is 0x00007033
claim_interface: Interface 0 of device from QueryInterface is 0x1042263a0
libusb/darwin.c get_endpoints: building table of endpoints.
get_endpoints: Pipe 1: DIR: 1 number: 1
get_endpoints: Pipe 2: DIR: 0 number: 1
libusb/darwin.c get_endpoints: complete.
libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer: Transfering 5 bytes of data on endpoint 0x01
libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer: Transfering 64 bytes of data on endpoint 0x81

{snip....}

USB error: libusb/darwin.c usb_bulk_transfer: transaction timed out

USB error: usb_bulk_read: An error occured during read (see messages above)
usb_bulk_read Error reading:usb_bulk_read: An error occured during read (see messages above)libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer: Transfering 64 bytes of data on endpoint 0x81
USB error: libusb/darwin.c usb_bulk_transfer: transaction timed out
USB error: usb_bulk_read: An error occured during read (see messages above)
usb_bulk_read Error reading:usb_bulk_read: An error occured during read (see messages above)libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer: Transfering 64 bytes of data on endpoint 0x81
libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer: Transfering 3 bytes of data on endpoint 0x01
libusb/darwin.c ep_to_pipeRef: Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer: Transfering 64 bytes of data on endpoint 0x81
USB error: libusb/darwin.c usb_bulk_transfer: transaction timed out
USB error: usb_bulk_read: An error occured during read (see messages above)
usb_bulk_read Error reading:usb_bulk_read: An error occured during read (see messages above)USB error: libusb/darwin.c usb_bulk_transfer: transaction timed out
USB error: usb_bulk_read: An error occured during read (see messages above)
usb_bulk_read Error reading:usb_bulk_read: An error occured during read (see messages above)usb_os_close: 0fcf:1008


If I stop the application, remove the device and start over, all is OK. It's only after physically removing the device am I able to talk to it without issue.

Any ideas as to what is going on here ?

Thanks

J

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Libusb-devel mailing list
Libusb-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Xiaofan Chen | 8 Nov 2011 12:16
Picon

Re: Timeouts on OSX

On Mon, Nov 7, 2011 at 1:05 AM, Justin Knotzke <jknotzke <at> shampoo.ca> wrote:
> I am having some issues with libusb and OSX 10.7.2.
>
> I am having nearly the same issues using standard IOKit so I do not think
> this is a libusb issue. But maybe someone can help me.
>
> I have a USB stick that does not use a driver of any sort. I am able to read
> and write off this stick without issue. The issue arises when I close down
> the device and the application and restart. libusb finds the device appears
> to open it and then throws a series of timeout errors. Here is how I am
> closing down the devices:
>
>  if (usb_device) {
>         rc = usb_release_interface(usb_device, readEndpoint);
>         rc = usb_release_interface(usb_device, writeEndpoint);
>         rc = usb_close(usb_device);
>     }
>

The above codes are apparently wrong. Please read the docs
of usb_release_interface().

+++++
usb_release_interface()
Name
usb_release_interface -- Releases a previously claimed interface
Description
int usb_release_interface(usb_dev_handle *dev, int interface);

usb_release_interface() releases an interface previously claimed with
usb_claim_interface. The interface parameter is the value as specified
 in the descriptor field bInterfaceNumber.

Returns 0 on success or < 0 on error.
+++++

How many interfaces does the device have?

Maybe your device does not like the above command and then
the firmware goes to a fault state.

--

-- 
Xiaofan

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1

Gmane