Ticket #109 (closed enhancement: fixed)

Opened 2 years ago

Last modified 18 months ago

[PATCH] Fix and enhance logging in os/linux_usbfs.c

Reported by: pekkanikander Owned by: pekkanikander
Milestone: Component: libusb-1.0
Keywords: linux Cc:
Blocked By: Blocks:

Description

We had some odd problems while debugging libusb on Android, related to udev not working properly on Android. The first enclosed patch fixes and enhances error logging in os/linux_usbfs.c. The second patch adds a couple of debug logs; it may or may not be reasonable.

Attachments

libusb.patch1 (901 bytes) - added by pekkanikander 2 years ago.
libusb.patch2 (824 bytes) - added by pekkanikander 2 years ago.

Download all attachments as: .zip

Change History

Changed 2 years ago by pekkanikander

Changed 2 years ago by pekkanikander

comment:1 Changed 2 years ago by stuge

  • Keywords linux added

The change to use two %s in the first patch doesn't seem neccessary. Note that the code before your patch concatenates the error message with the error description since there is no comma at the end of the first line.

Could you provide some details about the problems that you encountered with this logging?

I think the second hunk of the first patch and the first hunk of the second patch are helpful, but the filename being opened could very easily be verified using strace so I don't know how useful it is to add the second hunk of the second patch.

comment:2 Changed 2 years ago by pekkanikander

I didn't notice the concatenation; sorry for that.

The problem that we occasionally see is that /dev/bus/usb and the usbfs at /proc/bus/usb get unsynchronised on Android 2.3.4 / CyanogenMod? 7.1.0 with a 2.6.32.9 kernel. That is, if we plug out and plug in an USB device fast (which actually happens since our firmware on the device crashes and reboots), occasionally the two subsystems lose synchrony. One may have the "new" view, after the reboot, and the other the old one. E.g. our device is visible at the same time as /proc/bus/usb/002/004 and /dev/bus/usb/002/003.

That was a little bit hard to debug, and adding the enhanced logging messages helped a lot.

comment:3 Changed 18 months ago by pekkanikander

In [6583372125d73543fe0db9fdc59850b9c6aa50d9/libusb]:

Add debug message with libusb_open() error code

References #109.

comment:4 Changed 18 months ago by pekkanikander

  • Owner set to pekkanikander
  • Resolution set to fixed
  • Status changed from new to closed

In [0a828082aeedc6d19b6de4e3b10cc9762352fa7f/libusb]:

Linux: Add libusb_open() debug and error messages with the device path

Fixes #109.

Note: See TracTickets for help on using tickets.