- Debugger: Getting mixed signals
- 'Packaging Infrastructure' Contract Weekly Report #4
- Haiku monthly activity report - 06/2015
- 'Packaging Infrastructure' Contract Weekly Report #3
- 'Packaging Infrastructure' Contract Weekly Report #2
- GCI 2014 winners trip report (mentor side)
- TeX Live and LyX; Changes to the boot code
- 'Packaging Infrastructure' Contract Weekly Report #1
- Beginning of 'Packaging Infrastructure' Contract
- Haiku monthly activity report - 05/2015
LibUSB Port : Quarter Term
Hello Everyone!
Here is an update on the port.
I decided to use usb_raw instead of USBKit. Majority of functionalities are now implemented, leaving the specifics of Error Handling, etc.
Below I mention some of my design choices, the reasons for them, and problems faced.
-
Getting the device configuration descriptor using a control transfer, instead of building it up using configuration, interface, endpoint and generic descriptors.
While parsing the configuration descriptor, the Bus Manager module skips over vendor specific descriptors following the configuration descriptor, and clubs those following interfaces and endpoints into a single list for that interface. I’m still iterating over all the interfaces, endpoints, for making translation-hashes, something which we can avoid by writing a parser for the fetched configuration, if required. - Claim/Release Interface. I have implemented this using a list of claimed interfaces, kept in the USBDevice class (giving a pseudo-functionality to all libusb handles). This functionality should actually be implemented at a layer below, in the Bus Manager module, to provide exclusive access to interfaces, and prevent change of configurations/ alternate settings while someone has claimed an interface.
- Getting String Descriptors. This still fails for UHCI devices, and I am unable to find a reason for this. For EHCI, I was able to find the reason and have submitted a patch for this. I have opened a ticket for both the cases.
- I’m using BUSBRoster to enumerate and handle addition/removal of USB Devices. We would probably like to do away with this, given that we are not using USBKit.
- Release interface requires setting the alternate setting of the interface to 0. Doing this hangs the device, and no further transfers can be queued for the device. And the weird part is that the ioctl call to set the alternate setting, succeeds without any errors.
- Mass Storage Tests are now working.
Thanks a lot for giving me an opportunity to work on this project.
Feel free to provide your feedback.
[1] Link to github repository : https://github.com/akshay1994/libusb
[2] Link to Ticket [EHCI] : https://dev.haiku-os.org/ticket/10867
[3] Link to Ticket [UHCI] : https://dev.haiku-os.org/ticket/10915
- akshay1994's blog
- Login or register to post comments

Comments
Re: LibUSB Port : Quarter Term
Are you working on any detailed docs that will help others write drivers for USB devices.
I have a set of USB speakers that are suppose to be simple to use but don't presently work with Haiku. I would love to write a simple 16 bit stereo drive for them.
But I can't make out heads or tails how USB drivers are suppose to work. I have written/hacked/been coached into getting a working parallel port sound driver. I have gotten updated/hacked/been coached to get ram disk driver working but USB is like black magic to me.
PS. Don't try too hard, at 58 I maybe too old to learn this stuff.
Re: LibUSB Port : Quarter Term
The "USB in a nutshell" book helps a lot in understanding the USB protocol. With our APIs being rather low level, it's easy to map them to the concepts explained in that book, which is available for free in online form.
That being said, we already have a driver for usb audio devices. The problem is usb audio needs isosynchronous transfers, and only our OHCI driver implements that. Unfortunately, modern computers come with UHCI and EHCI ports, but rarely OHCI.
Re: LibUSB Port : Quarter Term
Thank you for your contribution to the Haiku Project !!!
:-)
Regards