libs(libasyncio libmemtrack libprocinfo libusbhost) have
vendor variants and they are also used by LLNDK(libmediandk)
which means these libs can be double-loaded.
deps:
- libmediandk -> libmedia_jni -> libmtp -> libasyncio
- libmediandk -> libmedia_jni -> libandroid_runtime -> libmemtrack
- libmediandk -> libmedia_jni -> libandroid_runtime -> libdebuggerd_client -> libprocinfo
- libmediandk -> libmedia_jni -> libmtp -> libusbhost
Bug: 121280180
Test: m -j
Change-Id: I2c2b5d67cf47b85a2aa8c08f85c7e1a84490cf4e
The 16kB maximum for transfers was removed from
the kernel in 3.3. Devio has since supported
arbitrary transfer sizes through scatter gather.
See the following kernel patches for context:
"USB: change the memory limits in usbfs URB submission"
"usbdevfs: Use scatter-gather lists for large bulk transfers"
Bug: 67683483
Test: Run usb_async_test app with USB3 : 38MB/s -> 300MB/s
Change-Id: Ia52440cb725561b0f1db1a75aa1b8ab952585826
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
Merged-In: If8f98fee4be6ea75dc0f7ce7beba7fd7b6aabf88
Test: Connected & disconnected a NuForceDAC.
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.
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
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 9b0ed72942)
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
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
Parameter is implicily converted to unsigned when assigned to the struct,
so make sure users are aware of this.
Test: compiled
Change-Id: I25ca6b24591497aa4e7ce8db262ce1099c2b7b09
Some devices fail to send USB string descriptors if you attempt to read more
than 255 bytes
Bug: 21871761
Change-Id: Id5b8865179f80523f0ad5b6028d49dd99db2b36b
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
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>
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
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
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
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>
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>
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
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
Otherwise the kernel will return an EINVAL error
Change-Id: I906472a4128eb26c5be7865142bc4a52464cf5f8
Bug: 4065217
Signed-off-by: Mike Lockwood <lockwood@android.com>
Also clean up and add timeout to control request transfer
Change-Id: Ibc2d8ac64d0fa90e0a23e6225ce2c49b23bb0d97
Signed-off-by: Mike Lockwood <lockwood@android.com>
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>
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>
This allows converting from unique IDs to USB device names
Change-Id: I8e3b300790c01383aed8e3d4f547b54bcb7c2cd4
Signed-off-by: Mike Lockwood <lockwood@android.com>
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>