History log of /haiku/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp
Revision Date Author Comments
# c2e8b317 23-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

usb_raw: Fetch default language before fetching string descriptors.

This fixes strange hangs that occur with some devices when fetching
their string descriptors with language-id "0".


# 76ddb69a 13-Dec-2022 Jérôme Duval <jerome.duval@gmail.com>

usb_raw: abort transfers cleanly on kill, fix use-after-free

* aborted transfers will release the notify semaphore when the cancel is notified.
* the allocated buffer would be freed on return, while the usb stack eventually copied
data in the buffer in our back, leading to KDL crashes, because the freed buffer would
be right reallocated for some kernel team structures.
* regression introduced by hrev55806, the transfers didn't need to be cancelled before.

Change-Id: Ifb6e941f71d05c37c36f878059c33883bb72a67c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5905
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# d7f7aadf 26-Jan-2022 Augustin Cavalier <waddlesplash@gmail.com>

usb_raw: acquire_sem with B_KILL_CAN_INTERRUPT.

This way, applications blocked in usb_raw can actually be killed,
instead of "hanging" until the USB device is removed or the
transfer finishes.

Improves a number of USB tickets, but does not really "fix"
any of the underlying problems that lead to this happening.


# e20a08d1 26-Jan-2022 Augustin Cavalier <waddlesplash@gmail.com>

usb_raw: Use MutexLocker and MemoryDeleter in usb_raw_ioctl.

No functional change intended.


# 61013090 28-Jun-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

Attempt to fix deadlocking USB transfers

Whenever a device is removed, let usb_raw cancel all its pending
transfers. Does not seems to help with the issue I'm getting however.

Change-Id: Ie2856e68ea402c9f1cc352ac47bbca624e17d3dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1424
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Fredrik Modéen <fredrik@modeen.se>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 29dcf856 13-Feb-2019 Murai Takashi <tmurai01@gmail.com>

drivers/bus/usb: Fix potential memory leak

* Fix potential leak of 'controlData' at line 701, which is allocated
at line 695. Pointed out by Clang Static Analyzer.
* Add NULL check to 'controlData'.

Change-Id: I96b0244d05d303b4c08ac8969f5ce5fc2e5012f9
Reviewed-on: https://review.haiku-os.org/c/1059
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# b24d095e 12-Aug-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

usb: support for retrieving full configuration descriptors

In USB, the interface and endpoint descriptors, and possibly other
vendor-specific descriptors, are nested inside the configuration
descriptors. This makes it possible to retrieve the complete information
about a configuration in one single call.

Our drivers do this, and so does libusb (the Device Kit doesn't, it only
cares about individual descriptors and does not provide access to the
vendor-specific ones).

The driver did not expose the full descriptor, only the part that
belongs strictly to the configuration. libusb worked around this by
getting the descriptor from the device directly, using a control
transfer. This should be ok, but apparently some devices get confused
when you do this too often or at unexpected times.

These changes introduce a variation of the GET_CONFIGURATION_DESCRIPTOR
ioctl that allows the caller to specify a size. This way, one can get
the complete descriptor (after getting the configuration-only part to
figure out the size needed, most likely). The data is copied from
structures stored by the driver, so no further communication with the
device is necessary, making this safe to the problems mentioned above,
and faster.

Change-Id: Id97e40ea0d45b8c051ae8548486c4751fc6aad2a
Reviewed-on: https://review.haiku-os.org/453
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# ce0ef8c8 07-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

USB: Remove BeOSCompatibility.h and associated cruft.


# 82346661 24-Mar-2018 Jérôme Duval <jerome.duval@gmail.com>

usb_raw: the command struct wasn't copied back in some cases.

hopefully fixes #14050 after e2e571c0359ee6d08b6c9a36fba78a69b414fd14.


# e2e571c0 08-Feb-2018 Jérôme Duval <jerome.duval@gmail.com>

usb_raw: use user_memcpy to read/write the user buffers.

also check buffer addresses passed through structures. For transfers, first compute
the direction of the transfer, to copy before or after the actual transfer.


# f0704f6b 09-May-2013 Jérôme Duval <jerome.duval@gmail.com>

usb_raw: fixes 64 bit warnings


# 427e9659 25-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Revert back my change as its broken.
I will take some rest as obviously I should not allwed to commit anything rigth now.
Sorry guys.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cc6dd72f 25-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Update B_USB_RAW_COMMAND_GET_DESCRIPTOR to support retrieving
up to total_length a configuration descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42907 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1ce29039 24-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Revert r42812. As pointed by Michael, one can use
BUSBDevice::GetDescriptor() to retrieve whatever descriptor, including a
complete configuration descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42905 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d4155975 09-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Expand usb_raw ioctl to support retrieving full usb configuration descriptor from userland, not only the header part.
I try to keep UBSConfiguration binary compatibility, but proofreading is welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42812 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b950cc65 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

* Enlarge the device name buffer a bit as with a deep enough hierarchy we might
actually hit this limit.
* Use snprintf() instead of sprintf() as suggested by CID 6447 (even though the
USB module isn't supposed to return such a malformed string).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bf905cfe 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

* Fix another non-problematic hidden parameter CID 5218.
* Check the length of the incoming buffer before accessing it through the union.
It's necessary to do this dependent on the operation at hand, since the caller
doesn't need to provide the full union size and the size may differ between
(still compatible) protocol versions.
* Replace memcpy() by user_memcpy() where data is exchanged with userland.
* Small style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39907 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3d7bd2dc 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

Cosmetical change only: don't shadow the "buffer" parameter with the local
variable. Didn't matter, as the parameter is only accessed through the
usb_raw_command variable that it is casted to early in the function. CID 5219.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ac40d720 30-Jun-2010 Wim van der Meer <wpjvandermeer@gmail.com>

Fixing the memory leak intruduced by my previous patch. Thanks to Ithamar for pointing this out.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37325 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89e73c2b 01-Jul-2010 Wim van der Meer <wpjvandermeer@gmail.com>

Fix to get rid of a 'deprecated conversion from string constant to 'char*'' warning.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37324 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89dda280 10-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

* Extend the usb_raw interface by alternate interface aware getters for
interfaces, endpoints and generic descriptors.
* Add getter for active interface index and simplify the count operation as
it isn't misused to also get interface descriptors anymore.
* Refactor out some common code into helper functions.
* Adapt the USBKit to the changed/new interface.
* Change how alternate interfaces are exposed by USBKit by providing normal
BUSBInterface objects for alternate interfaces that can easily be examined
and used.
* Make BUSBInterface class aware of its alternate index and use the alternate
aware usb_raw functionallity to build the endpoint and descriptor lists.
* Add ActiveAlternateIndex() to find out what alternate is currently active.
* Style cleanup of the USBKit classes, use std::nothrow everywhere and check
all allocations. Simplify some code by removing optimization where the benefit
is questionable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27409 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c8661c38 12-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Make a local copy of the passed in isochronous packet descriptors before
handing them over to the USB stack. Otherwise the finisher (kernel) thread
would have no way to fill those packets when they came from a user space
address range. Completely untested though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24947 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 017d539c 10-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

A few more things to get the USB stack working under BeOS again. We now have
KDEBUG on by default which causes benaphores to always use their semaphore.
Therefore when initing the benaphore with the inline compatibility function
and then using it using the lock.h provided inline would always cause a
deadlock and a hanging system under BeOS. Also we now (re-)define the
B_KERNEL_{READ|WRITE}_AREA defines for non Haiku targets to 0 apparently which
would probably also cause the stack to misbehave. Therefore they are now
just redefined (again) to plain B_{READ|WRITE}_AREA in BeOSCompatibility.h.
Change the inclusion order in some places so things work as expected.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bfbbfedc 08-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Prepare usb_raw.h for eventually being made public. Prefixed enums values
with B_USB_* and the command union is now usb_raw_command.
* Changed usb_raw and the BUSB* classes accordingly.
* Moved the raw_device struct into usb_raw.cpp as suggested by Francois as it
was the only thing usb_raw_private.h defined.
* Removed usb_raw_private.h again because of the above.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24861 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d419b482 07-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Integrate the USBKit into libdevice and make it public. I left the USBKit.h
name, as it in fact is like a kit in the kit. It combines the different BUSB*
classes as compared to SerialPort.h where there really is a 1:1 relationship
between the header and the (one) class. If someone has a better fitting name
please shout.
Separated the usb_raw.h into usb_raw.h which defines the protocol and
usb_raw_private.h which holds the internal device structure for usb_raw. This
reduces the header dependencies.
Hopefully cought all occurencies of USBKit.a usage (in usb_dev_info and
the usb_webcam media add-on) but might have missed something that is not in
the image.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24858 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5aa70ae1 06-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Add a AlternateAt() method to the BUSBInterface class that can retrieve the
usb_interface_descriptor of an alternate interface without having to switch
to it.
* Add some reserve bytes to all classes and add some reserved virtual slots
where the objects are publically constructable.
* Remove the source compatibilty defines that were briding the old USB* with
the new BUSB* class names.
* Implement the usb_raw side of getting an alternate interface descriptor.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24842 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 49df4099 06-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Implement a binary compatible way of setting an alternate interface through
usb_raw.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24835 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86fee180 10-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Reset the freed device name list so it is not freed a second time on republish. Also check the allocation of the new name list.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23337 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ba665ca 18-Sep-2007 Jérôme Duval <korli@users.berlios.de>

destroy benaphore lock on error in init_driver()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22245 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ca97e35 17-Jul-2007 Michael Lotz <mmlr@mlotz.ch>

Patches by Salvatore Benedetto to fix changes made by me and also the underlaying problem that caused high CPU usage in the isochronous finisher thread. Also includes patches to support isochronous support through USBKit / usb_raw. Thanks!

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21636 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2852a6db 25-Mar-2007 Michael Lotz <mmlr@mlotz.ch>

Removed transfer buffer in usb_raw driver. The user provided buffers are now used directly which saves two memcpy operations and removes the 4K transfer length restriction from the USBKit.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17f83b21 24-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Switched from the old v2 callback status codes to the new v3 codes
This means that the usb_callback_func now takes a status_t instead of a uint32 status.
Also the error codes are now different. I don't see this as a real problem in binary compatibility, as the status codes were never really documented and most drivers just assumed that a nonzero status meant an error.
Source compatibility breaks for callback functions and error defines. I fixed (hopefully) all places in the tree that are currenty included in the image and affected by the change.
* Corrected error reporting in UHCI and EHCI using the new status codes.
* Fixed a memory leak in EHCI where the async advance interrupt was not triggered in time.
* Fixed another race condition in usb_raw that could cause a crash when a device is removed while a transfer is pending.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18916 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42056120 23-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Made usb_raw more robust and correct when handling rescans and adding/removing devices
* Fixed warnings when debug output is on
* Disabled debug output

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18913 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cef51994 22-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

As Jerome put out correctly, I have forgotten to commit the v3 changes to usb_raw.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18577 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5591ec21 16-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

Use the new usb_ioctl to get the logical device name for publishing devfs entries in usb_raw.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18516 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c768687 15-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

Adding usb_raw driver. Written from scratch, but kept the data structures and status codes to be compatible with existing apps. Tested OK with the PTP plugin for Exposure.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18512 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f0704f6ba43d77938c9856c0dcb3c84c106f9c87 09-May-2013 Jérôme Duval <jerome.duval@gmail.com>

usb_raw: fixes 64 bit warnings


# 427e96598c55e68f2de5b090a752c45b2f14d378 25-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Revert back my change as its broken.
I will take some rest as obviously I should not allwed to commit anything rigth now.
Sorry guys.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cc6dd72fbb10a2bf59019619b186bb5af1f0473f 25-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Update B_USB_RAW_COMMAND_GET_DESCRIPTOR to support retrieving
up to total_length a configuration descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42907 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1ce29039cdb74fff21e73ab6cd8b5c8bf51caba8 24-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Revert r42812. As pointed by Michael, one can use
BUSBDevice::GetDescriptor() to retrieve whatever descriptor, including a
complete configuration descriptor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42905 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d41559757e228cf311731050388e2534c660a55a 09-Oct-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Expand usb_raw ioctl to support retrieving full usb configuration descriptor from userland, not only the header part.
I try to keep UBSConfiguration binary compatibility, but proofreading is welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42812 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b950cc6532ee2afdeab5469b74c453e55c5caee8 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

* Enlarge the device name buffer a bit as with a deep enough hierarchy we might
actually hit this limit.
* Use snprintf() instead of sprintf() as suggested by CID 6447 (even though the
USB module isn't supposed to return such a malformed string).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bf905cfe0cc9b35e85bde3393ab6a0b99376fe40 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

* Fix another non-problematic hidden parameter CID 5218.
* Check the length of the incoming buffer before accessing it through the union.
It's necessary to do this dependent on the operation at hand, since the caller
doesn't need to provide the full union size and the size may differ between
(still compatible) protocol versions.
* Replace memcpy() by user_memcpy() where data is exchanged with userland.
* Small style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39907 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3d7bd2dc232c043ef06cf99bdddcf2e37e9c0f85 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

Cosmetical change only: don't shadow the "buffer" parameter with the local
variable. Didn't matter, as the parameter is only accessed through the
usb_raw_command variable that it is casted to early in the function. CID 5219.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ac40d7205b88c8ea5516deb03fc5e2171993d7f4 30-Jun-2010 Wim van der Meer <wpjvandermeer@gmail.com>

Fixing the memory leak intruduced by my previous patch. Thanks to Ithamar for pointing this out.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37325 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89e73c2bbc9d31e2990899ccb5ab664e0e855c1d 01-Jul-2010 Wim van der Meer <wpjvandermeer@gmail.com>

Fix to get rid of a 'deprecated conversion from string constant to 'char*'' warning.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37324 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89dda2805209631fb64bd73e4f30df28405ca985 10-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

* Extend the usb_raw interface by alternate interface aware getters for
interfaces, endpoints and generic descriptors.
* Add getter for active interface index and simplify the count operation as
it isn't misused to also get interface descriptors anymore.
* Refactor out some common code into helper functions.
* Adapt the USBKit to the changed/new interface.
* Change how alternate interfaces are exposed by USBKit by providing normal
BUSBInterface objects for alternate interfaces that can easily be examined
and used.
* Make BUSBInterface class aware of its alternate index and use the alternate
aware usb_raw functionallity to build the endpoint and descriptor lists.
* Add ActiveAlternateIndex() to find out what alternate is currently active.
* Style cleanup of the USBKit classes, use std::nothrow everywhere and check
all allocations. Simplify some code by removing optimization where the benefit
is questionable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27409 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0f1a7f1e76f31db24a21a42cbb01d7b9c 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c8661c38859dea60d4f880fc8932729eeeef92de 12-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Make a local copy of the passed in isochronous packet descriptors before
handing them over to the USB stack. Otherwise the finisher (kernel) thread
would have no way to fill those packets when they came from a user space
address range. Completely untested though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24947 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 017d539c2a68107b0f1575ae7c2f0fdd4ab294f1 10-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

A few more things to get the USB stack working under BeOS again. We now have
KDEBUG on by default which causes benaphores to always use their semaphore.
Therefore when initing the benaphore with the inline compatibility function
and then using it using the lock.h provided inline would always cause a
deadlock and a hanging system under BeOS. Also we now (re-)define the
B_KERNEL_{READ|WRITE}_AREA defines for non Haiku targets to 0 apparently which
would probably also cause the stack to misbehave. Therefore they are now
just redefined (again) to plain B_{READ|WRITE}_AREA in BeOSCompatibility.h.
Change the inclusion order in some places so things work as expected.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bfbbfedc5f5a1e9ebb261dcf9095f647eb87f84c 08-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Prepare usb_raw.h for eventually being made public. Prefixed enums values
with B_USB_* and the command union is now usb_raw_command.
* Changed usb_raw and the BUSB* classes accordingly.
* Moved the raw_device struct into usb_raw.cpp as suggested by Francois as it
was the only thing usb_raw_private.h defined.
* Removed usb_raw_private.h again because of the above.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24861 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d419b482adf7aad578bc94e3d8142683356d5f99 07-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Integrate the USBKit into libdevice and make it public. I left the USBKit.h
name, as it in fact is like a kit in the kit. It combines the different BUSB*
classes as compared to SerialPort.h where there really is a 1:1 relationship
between the header and the (one) class. If someone has a better fitting name
please shout.
Separated the usb_raw.h into usb_raw.h which defines the protocol and
usb_raw_private.h which holds the internal device structure for usb_raw. This
reduces the header dependencies.
Hopefully cought all occurencies of USBKit.a usage (in usb_dev_info and
the usb_webcam media add-on) but might have missed something that is not in
the image.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24858 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5aa70ae1108840c0fbdb3413654ff4536792ef5e 06-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Add a AlternateAt() method to the BUSBInterface class that can retrieve the
usb_interface_descriptor of an alternate interface without having to switch
to it.
* Add some reserve bytes to all classes and add some reserved virtual slots
where the objects are publically constructable.
* Remove the source compatibilty defines that were briding the old USB* with
the new BUSB* class names.
* Implement the usb_raw side of getting an alternate interface descriptor.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24842 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 49df4099d1da0432db60774252d0c0413210d30a 06-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Implement a binary compatible way of setting an alternate interface through
usb_raw.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24835 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86fee1806c73c0f87c1ef90053824309c25ed2e5 10-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Reset the freed device name list so it is not freed a second time on republish. Also check the allocation of the new name list.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23337 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3ba665ca6907f146b1fada446a15bbd6e64c835b 18-Sep-2007 Jérôme Duval <korli@users.berlios.de>

destroy benaphore lock on error in init_driver()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22245 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ca97e354826f2569efddb8100b32d8f61db9c59 17-Jul-2007 Michael Lotz <mmlr@mlotz.ch>

Patches by Salvatore Benedetto to fix changes made by me and also the underlaying problem that caused high CPU usage in the isochronous finisher thread. Also includes patches to support isochronous support through USBKit / usb_raw. Thanks!

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21636 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2852a6db8fba6ba900ccbc9f007f970562698db1 25-Mar-2007 Michael Lotz <mmlr@mlotz.ch>

Removed transfer buffer in usb_raw driver. The user provided buffers are now used directly which saves two memcpy operations and removes the 4K transfer length restriction from the USBKit.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17f83b219d63eae4de462d6868e7d26ad6c3949e 24-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Switched from the old v2 callback status codes to the new v3 codes
This means that the usb_callback_func now takes a status_t instead of a uint32 status.
Also the error codes are now different. I don't see this as a real problem in binary compatibility, as the status codes were never really documented and most drivers just assumed that a nonzero status meant an error.
Source compatibility breaks for callback functions and error defines. I fixed (hopefully) all places in the tree that are currenty included in the image and affected by the change.
* Corrected error reporting in UHCI and EHCI using the new status codes.
* Fixed a memory leak in EHCI where the async advance interrupt was not triggered in time.
* Fixed another race condition in usb_raw that could cause a crash when a device is removed while a transfer is pending.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18916 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42056120126fd66024a1b921340cdb9d82757611 23-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Made usb_raw more robust and correct when handling rescans and adding/removing devices
* Fixed warnings when debug output is on
* Disabled debug output

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18913 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cef5199427b07343618f676d5086c53583ad656a 22-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

As Jerome put out correctly, I have forgotten to commit the v3 changes to usb_raw.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18577 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5591ec214e11425a088bc984a1cd27490fc58ca7 16-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

Use the new usb_ioctl to get the logical device name for publishing devfs entries in usb_raw.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18516 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c7686879453826db4e5bbfca60fc793a7208af5 15-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

Adding usb_raw driver. Written from scratch, but kept the data structures and status codes to be compatible with existing apps. Tested OK with the PTP plugin for Exposure.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18512 a95241bf-73f2-0310-859d-f6bbb57e9c96