From a88b42d569a91290477d8f5731a2ee43931271da Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Thu, 19 May 2011 11:52:40 -0400 Subject: USB: Add method to access raw USB device descriptors Change-Id: Id5b46ede14a838198a59bdc8ed4732942044cfa8 Signed-off-by: Mike Lockwood --- core/java/android/hardware/usb/UsbDeviceConnection.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/java') diff --git a/core/java/android/hardware/usb/UsbDeviceConnection.java b/core/java/android/hardware/usb/UsbDeviceConnection.java index a153c0b..b536490 100644 --- a/core/java/android/hardware/usb/UsbDeviceConnection.java +++ b/core/java/android/hardware/usb/UsbDeviceConnection.java @@ -69,6 +69,17 @@ public class UsbDeviceConnection { } /** + * Returns the raw USB descriptors for the device. + * This can be used to access descriptors not supported directly + * via the higher level APIs. + * + * @return raw USB descriptors + */ + public byte[] getRawDescriptors() { + return native_get_desc(); + } + + /** * Claims exclusive access to a {@link android.hardware.usb.UsbInterface}. * This must be done before sending or receiving data on any * {@link android.hardware.usb.UsbEndpoint}s belonging to the interface. @@ -160,6 +171,7 @@ public class UsbDeviceConnection { private native boolean native_open(String deviceName, FileDescriptor pfd); private native void native_close(); private native int native_get_fd(); + private native byte[] native_get_desc(); private native boolean native_claim_interface(int interfaceID, boolean force); private native boolean native_release_interface(int interfaceID); private native int native_control_request(int requestType, int request, int value, -- cgit v1.1