summaryrefslogtreecommitdiffstats
path: root/libusbhost
Commit message (Collapse)AuthorAgeFilesLines
* usblib: usb_device_get_string decoding fixes.Andrew Chant2017-12-182-23/+83
| | | | | | | | | | | | | | | usb_device_get_string converts incoming ucs-2 text to ascii by truncating the upper byte of each character. This is error prone. This patch introduces usb_device_get_string_ucs2 to access raw USB string descriptors, as well as changes usb_device_get_string to replace any non ascii character with '?'. Bug: 70163357 Change-Id: If8f98fee4be6ea75dc0f7ce7beba7fd7b6aabf88 Test: Connected & disconnected a NuForceDAC.
* Merge "usblib: fix race & delay waiting for perms on open" am: 255c43cd05 ↵Andrew Chant2017-12-081-17/+27
|\ | | | | | | | | | | | | | | am: 20346c2336 am: 366efbfba1 Change-Id: I418d980c1235ca747049feb710acc6a9e6ccea84
| * usblib: fix race & delay waiting for perms on openAndrew Chant2017-11-071-17/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in usb_device_open, if permission is denied for a USB device node, the current code retries read-only, then sleeps for a second before retrying. If the permission was changed to +rw between the two file opens, the device could be inadvertently opened read-only. Also, change the polling interval to 100ms. 1s is a long wait for a function on the critical path of a user interaction. Bug: 68337205 Bug: 68782236 Test: with debug messages enabled, connected & disconnected a USB audio headset. Saw the writeable file descriptor returned. Change-Id: I06048cc2c09bf6ed1abada5d12b5559be768fbaf
| * Mark the modules as VNDK in Android.bpJustin Yun2017-09-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a VNDK module, Android.bp must have 'vndk' tag as well as 'vendor_available: true'. The 'vndk' tag for VNDK module is formated as below: vndk: { enabled: true, }, VNDK modules will be installed both in system/lib(64) as normal and in system/lib(64)/vndk as a vendor variant. Bug: 63866913 Test: build and boot with BOARD_VNDK_VERSION=current Merged-In: Icecb22ed2ed0f58c3168605d4cf64815e2dda750 Change-Id: Icecb22ed2ed0f58c3168605d4cf64815e2dda750 (cherry picked from commit 9b0ed7294273d5f10020388e5a5b7e545a2fd1de)
* | Added get descriptors length function to enable direct access to raw ↵Paul McLean2017-11-062-3/+21
| | | | | | | | | | | | | | | | | | | | | | descriptors. Bug: 68936964 Test: manual Peripherals - Skylab, Mir, HTC dongle, Microsoft LX-3000 (headset), Rosewill (gaming) headset Peripherals - PreSonus AudioBox 22VSL Change-Id: Icbfd64c3ac29acab6a4c731d604cb0e620e41dc6
* | Mark the modules as VNDK in Android.bpJustin Yun2017-08-031-0/+4
|/ | | | | | | | | | | | | | | | | As a VNDK module, Android.bp must have 'vndk' tag as well as 'vendor_available: true'. The 'vndk' tag for VNDK module is formated as below: vndk: { enabled: true, }, VNDK modules will be installed both in system/lib(64) as normal and in system/lib(64)/vndk as a vendor variant. Bug: 63866913 Test: build and boot with BOARD_VNDK_VERSION=current Change-Id: Icecb22ed2ed0f58c3168605d4cf64815e2dda750
* Merge "Convert libusbhost to Android.bp" am: a58c4b5bcd am: dff208c80cDan Willemsen2017-04-203-57/+36
|\ | | | | | | | | | | am: 720faf195c Change-Id: I2912da737533ddc553fa3d69a8c084bb0926a217
| * Convert libusbhost to Android.bpDan Willemsen2017-04-203-57/+36
| | | | | | | | | | | | | | See build/soong/README.md for more information. Test: mmma -j system/core/libusbhost Change-Id: I57109380678bd452af545d4c5b1b9d2356b356b8
* | Merge "usblib: Wrap USBDEVFS_REAPURBNDELAY ioctl"Philip P. Moltmann2016-10-272-21/+36
|\ \
| * | usblib: Wrap USBDEVFS_REAPURBNDELAY ioctlPhilip P. Moltmann2016-10-262-21/+36
| |/ | | | | | | | | | | Test: Test is submitted alongside this change Bug: 31288102 Change-Id: I99311879150ef3f647c65205b35254736dde6de7
* / Add timeout to usb_device_control_transfer call in usbhost code.Vitalii Tomkiv2016-10-252-14/+15
|/ | | | | | | | | | usb_device_control_transfer used to use "0" value in control_transfer call which resulted in unlimited timeout. In case of bad USB devices connected it resulted in usbhost stuck state. Bug: 31923641 Test: manual run and test with bad devices. Change-Id: I4a2a691a6d83107f72ba506522c932085bd09624
* usb-bulk-transfer: Clarify sign-iy-ness of paramPhilip P. Moltmann2016-09-212-2/+2
| | | | | | | | Parameter is implicily converted to unsigned when assigned to the struct, so make sure users are aware of this. Test: compiled Change-Id: I25ca6b24591497aa4e7ce8db262ce1099c2b7b09
* Move libusbhost's headers into libusbhost.Elliott Hughes2016-09-162-8/+252
| | | | Change-Id: Ic5ff65bd6456ea3cc92e0c8f9d7a6f499e58dbfc
* libusbhost: add usb_device_resetKeun-young Park2016-01-131-0/+5
| | | | | bug: 26404209 Change-Id: I8f307d6683afe70fe334746f5be2856b79782493
* libusbhost: Fix problem reading USB string descriptors on some quirky devicesMike Lockwood2015-06-181-2/+5
| | | | | | | | Some devices fail to send USB string descriptors if you attempt to read more than 255 bytes Bug: 21871761 Change-Id: Id5b8865179f80523f0ad5b6028d49dd99db2b36b
* libusbhost: Add usb_device_get_version()Mike Lockwood2015-04-291-0/+6
| | | | Change-Id: If2161178e9fe94a94faf01c102ef64f2a72d093b
* am 0d8943c2: am e4c5b614: Merge "libusbhost: Fix IOCTL call during ↵Badhri Jagan Sridharan2014-08-121-1/+1
|\ | | | | | | | | | | | | usb_request_cancel" * commit '0d8943c252a21390c63a16ae0f9f1459c3212163': libusbhost: Fix IOCTL call during usb_request_cancel
| * libusbhost: Fix IOCTL call during usb_request_cancelBadhri Jagan Sridharan2014-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | USBDEVFS_DISCARDURB IOCTL call expects a pointer to the the urb structure to be passed from userspace. LibusbHost instead sends usbdevfs_urb**. Change this to usbdevfs_urb*. Fixes Issue: https://code.google.com/p/android/issues/detail?id=74530 Change-Id: Ifb8a13857e1a9f62536f2a07c0965e9c419b7d4c
* | am 5cdb3f92: am 6b5f4c34: am 0c7e5cda: Merge "libusbhost: Turn on -Werror"Mark Salyzyn2014-05-221-1/+3
|\| | | | | | | | | * commit '5cdb3f92c3f307d3d348a5a7247d052af6804740': libusbhost: Turn on -Werror
| * libusbhost: Turn on -WerrorMark Salyzyn2014-05-211-1/+3
| | | | | | | | Change-Id: Ia765b56197c28d6cde633db9c429001993f75f17
* | am 0a90004b: am cae898ac: am 3754791d: Merge "libusbhost: Fix issue of ↵JP Abgrall2014-05-011-3/+4
|\| | | | | | | | | | | | | multiple inotify event at same time." * commit '0a90004be8aba909391b25643ba943db76660fe4': libusbhost: Fix issue of multiple inotify event at same time.
| * libusbhost: Fix issue of multiple inotify event at same time.Bo Huang2014-04-251-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | libusbhost can handle multiple inotify events at same time on Kit kat. In original implementation, the function-level ret is assigned with length of read and used for while loop. if want to add a new watch for subdirectory,inotify_add_watch will update the function-level ret with watch descriptor. It impact on while loop to do exit. Add local result to avoid it. Change-Id: I101041ccfd54eaac14969a45e90ab2e49bdff578 Signed-off-by: Bo Huang <bo.b.huang@intel.com>
* | am 74a41f5a: am b659ffd7: am deb3eecd: Merge "Fix the definition of ↵Colin Cross2014-02-221-1/+1
|\| | | | | | | | | | | | | LOCAL_PATH in libusbhost/Android.mk" * commit '74a41f5adf10fcd6211d2933ada30fe08cd894c5': Fix the definition of LOCAL_PATH in libusbhost/Android.mk
| * Fix the definition of LOCAL_PATH in libusbhost/Android.mkKévin PETIT2014-02-121-1/+1
| | | | | | | | | | Change-Id: I870cac2f0e26644e4456743209aa45644d7e494b Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
| * libusbhost: It's no longer assumed that "bus/usb" exists once "bus" was createdZiv Hendel2013-08-261-3/+16
| | | | | | | | | | | | | | | | | | | | On some devices there is a slight delay between the creation of "/dev/bus" and "/dev/bus/usb". Previously, the code assumed that both are created in the same time which caused "watch_existing_subdirs" to fail and libusbhost to stop working until the device is rebooted. The fix will setup an inotify event on the creation of the "bus/usb" so it will not be missed once it's created. Change-Id: I17f06dd167e61573307425e48898e12ebc954093
* | libusbhost: Add usb_device_set_configuration and usb_device_set_interfaceMike Lockwood2014-01-131-15/+20
| | | | | | | | | | | | | | | | | | usb_device_set_configuration is to support devices with multiple configurations usb_device_set_interface supports switching between interfaces with alternate settings Also moved zero string index checking to usb_device_get_string Change-Id: I34610b25f135894a0cf752a33e5738d4314d7122
* | libusbhost: It's no longer assumed that "bus/usb" exists once "bus" was createdZiv Hendel2013-08-201-3/+16
|/ | | | | | | | | | On some devices there is a slight delay between the creation of "/dev/bus" and "/dev/bus/usb". Previously, the code assumed that both are created in the same time which caused "watch_existing_subdirs" to fail and libusbhost to stop working until the device is rebooted. The fix will setup an inotify event on the creation of the "bus/usb" so it will not be missed once it's created. Change-Id: I17f06dd167e61573307425e48898e12ebc954093
* Properly handle cases of multiple inotify eventsZiv Hendel2013-03-251-39/+44
| | | | | | | Bug: 8469799 Change-Id: Ie10242dd05becd142cc84651d5e5795e4c02270d Signed-off-by: Igor Murashkin <iam@google.com> Signed-off-by: Adam Hampson <ahampson@google.com>
* libusbhost: generates a static libraryGuillaume Ranquet2012-12-101-0/+10
| | | | | | | | | | due to limitations of the droidboot OS used for POS, there's a need for a static libusbhost library. this permits to include libusbhost in droidboot Change-Id: I0f0c07817ad19b773b466b69fd6e997877d41b34 Signed-off-by: Guillaume Ranquet <guillaumex.ranquet@intel.com>
* libusbhost: permits client polling on inotify wdGuillaume Ranquet2012-12-101-65/+105
| | | | | | | | | | | | Modify libusbhost to expose the inotify watch descriptor to clients This modification permits clients to add the watch descriptor to their polling loop so that they don't have to use a dedicated thread only for libusbhost. Change-Id: I615bfcd56beab978135034b228d4d93337351eab Signed-off-by: Guillaume Ranquet <guillaumex.ranquet@intel.com> Signed-off-by: Luc Piguet-Lacroix <lucx.piguet-lacroix@intel.com>
* libusbhost: Fix USB device discovery on bootBenoit Goby2012-08-021-15/+43
| | | | | | | | On some devices, /dev/bus/usb does not exist on boot, it is only created when the otg port is in host mode. Use inotify to detect when /dev/bus/usb is created and then start watching subdirectories. Change-Id: Ic1472a5ea7a7118cdbb560cc7071ade9bcee753a
* libusbhost: Fix possible missed "device added" notificationBenoit Goby2012-08-021-20/+43
| | | | | | | | | | When a new bus is added, check for existing devices in the bus directory, since devices may have been added before calling inotify_add_watch. Also add missing inotify_rm_watch calls. Change-Id: Ie69fc995a3e8b18431099b252be86f0054fe5531
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-031-1/+1
| | | | | Bug: 5449033 Change-Id: I9244d927f14c750cd359ebffb1fc1c355a755d5a
* libusbhost: Limit bulk transfer requests to 16384 bytesMike Lockwood2011-03-121-1/+12
| | | | | | | | | Otherwise the kernel will return an EINVAL error Change-Id: I906472a4128eb26c5be7865142bc4a52464cf5f8 Bug: 4065217 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Save endpoint ID in usb_request structMike Lockwood2011-02-141-0/+1
| | | | | Change-Id: I2cf189cee67c2efbcf919c8bae1447a6cb112f02 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add call for synchronous bulk transfersMike Lockwood2011-01-271-28/+46
| | | | | | | Also clean up and add timeout to control request transfer Change-Id: Ibc2d8ac64d0fa90e0a23e6225ce2c49b23bb0d97 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add usb_device_connect_kernel_driver()Mike Lockwood2011-01-221-2/+17
| | | | | | | | | | This can be used to ask the kernel to disconnect its driver for a device so usb_device_claim_interface() can claim it instead. Also increased size of descriptor buffer and added some debugging logs Change-Id: I4945196d957fb8493716eb9b7e5463c06b168ef1 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Support for multiple pending requests on a single endpointMike Lockwood2011-01-062-56/+52
| | | | | | | Add new usb_request struct to replace usb_endpoint, which is no longer needed. Change-Id: Ia3637b3431a3597caced41bfec677ef0b044a453 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add usb_device_get_name_from_unique_id()Mike Lockwood2010-12-291-0/+10
| | | | | | | This allows converting from unique IDs to USB device names Change-Id: I8e3b300790c01383aed8e3d4f547b54bcb7c2cd4 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Change libusbhost from static to shared libraryMike Lockwood2010-12-291-2/+2
| | | | | Change-Id: I0c16cc4536c4ab700c33433c8a6323ade7cfc95d Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Fix breakage due to not storing dev_name in struct usb_deviceMike Lockwood2010-12-151-0/+1
| | | | | Change-Id: Iefac9b31f900edb2dbd594f9eff9113b2038757d Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add accessor for the USB device descriptorMike Lockwood2010-12-131-0/+5
| | | | | Change-Id: Ic3a54e2a06f3b4fa72f99b64025a911fbf525daf Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add support for creating a usb_device struct from an existing fdMike Lockwood2010-12-131-23/+51
| | | | | | | We will use this for sharing USB file descriptors across address spaces via Binder Change-Id: Iadbd3e0a4178f79d1d778fdfd5175f6fe0e2aaf5 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: add usb_device_get_unique_id_from_name()Mike Lockwood2010-07-271-0/+7
| | | | | Change-Id: Idce54fc26d0432d4dc46f605623c4960c0e8690f Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add usb_device_send_control for sending raw commands on endpoint 0.Mike Lockwood2010-07-241-28/+34
| | | | | Change-Id: If883f2690c4031b9ba4d5cf943b5bf5c13193bce Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Fix deadlock on devices without USB host support.Mike Lockwood2010-07-201-0/+2
| | | | | Change-Id: Ic91f99d1169fcdc00474dd6a870eb7e614128bc2 Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Add callback to usb_host_run to notify when initial device ↵Mike Lockwood2010-07-201-0/+3
| | | | | | | | | | | discovery is done This can be used to eliminate race conditions in clients that operate immediately on the currently connected device list. Signed-off-by: Mike Lockwood <lockwood@android.com> Change-Id: I14954b9fcc84239950ead6bdc1a0a888882c2226
* libusbhost: The client is now responsible for creating the thread that ↵Mike Lockwood2010-07-011-47/+49
| | | | | | | | | | monitors the bus This is to allow using a thread that is capable of calling through JNI to Java code to report USB device attached/removed events. Change-Id: Ia58592607a2c1f4357b31072044f5db5617d7f5b Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Use logcat for debugging when building device library.Mike Lockwood2010-06-102-6/+20
| | | | Signed-off-by: Mike Lockwood <lockwood@android.com>
* libusbhost: Added usb_device_get_unique_idMike Lockwood2010-06-011-0/+8
| | | | Signed-off-by: Mike Lockwood <lockwood@android.com>