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
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
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
comment:4 Changed 18 months ago by pekkanikander
- Owner set to pekkanikander
- Resolution set to fixed
- Status changed from new to closed
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.