public String DeviceInfo(int paramInt) throws Exception {
byte b1 = 1;
StringBuilder stringBuilder = new StringBuilder();
UsbManager usbManager = (UsbManager)BA.applicationContext.getSystemService("usb");
HashMap hashMap = usbManager.getDeviceList();
if (hashMap.size() == 0)
return "No device found. Is an Accessory connected?";
UsbDevice usbDevice = null;
for (UsbDevice usbDevice1 : hashMap.values()) {
if (b1++ == paramInt) {
usbDevice = usbDevice1;
break;
}
}
UsbInterface usbInterface = usbDevice.getInterface(0);
UsbDeviceConnection usbDeviceConnection = usbManager.openDevice(usbDevice);
usbDeviceConnection.claimInterface(usbInterface, true);
byte[] arrayOfByte1 = usbDeviceConnection.getRawDescriptors();
byte b = arrayOfByte1[14];
byte[] arrayOfByte2 = new byte[arrayOfByte1[7]];
usbDeviceConnection.controlTransfer(128, 6, 768 + b, 0, arrayOfByte2, arrayOfByte2.length, 100);
stringBuilder.append("Manufacturer : ").append(bytes0ToString(arrayOfByte2, b)).append('\n');
b = arrayOfByte1[15];
arrayOfByte2 = new byte[arrayOfByte1[7]];
usbDeviceConnection.controlTransfer(128, 6, 768 + b, 0, arrayOfByte2, arrayOfByte2.length, 100);
stringBuilder.append("Product : ").append(bytes0ToString(arrayOfByte2, b)).append('\n');
b = arrayOfByte1[16];
arrayOfByte2 = new byte[arrayOfByte1[7]];
usbDeviceConnection.controlTransfer(128, 6, 768 + b, 0, arrayOfByte2, arrayOfByte2.length, 100);
stringBuilder.append("Serial : ").append(bytes0ToString(arrayOfByte2, b)).append('\n');
stringBuilder.append('\n');
stringBuilder.append("DeviceName : ").append(usbDevice.getDeviceName()).append('\n');
stringBuilder.append("DeviceClass : ").append(usbClass(usbDevice.getDeviceClass())).append('\n');
stringBuilder.append("DeviceSubClass : ").append(usbDevice.getDeviceSubclass()).append('\n');
stringBuilder.append("Device ID : ").append(toHex(usbDevice.getDeviceId())).append('\n');
stringBuilder.append("ProductId : ").append(toHex(usbDevice.getProductId())).append('\n');
stringBuilder.append("VendorId : ").append(toHex(usbDevice.getVendorId())).append('\n');
stringBuilder.append('\n');
for (byte b2 = 0; b2 < usbDevice.getInterfaceCount(); b2++) {
UsbInterface usbInterface1 = usbDevice.getInterface(b2);
stringBuilder.append(" B4aInterfaceNumber : ").append(b2).append('\n');
stringBuilder.append(" InterfaceClass : ").append(usbClass(usbInterface1.getInterfaceClass())).append('\n');
stringBuilder.append(" InterfaceSubClass : ").append(usbInterface1.getInterfaceSubclass()).append('\n');
stringBuilder.append(" InterfaceProtocol : ").append(usbInterface1.getInterfaceProtocol()).append('\n');
stringBuilder.append('\n');
for (byte b3 = 0; b3 < usbInterface1.getEndpointCount(); b3++) {
UsbEndpoint usbEndpoint = usbInterface1.getEndpoint(b3);
stringBuilder.append(" EndpointNumber : ").append(usbEndpoint.getEndpointNumber()).append('\n');
stringBuilder.append(" EndpointDirection : ").append(usbDirection(usbEndpoint.getDirection())).append('\n');
stringBuilder.append(" EndpointType : ").append(usbEndpoint(usbEndpoint.getType())).append('\n');
stringBuilder.append(" EndpointAttribute : ").append(usbEndpoint.getAttributes()).append('\n');
stringBuilder.append(" EndpointInterval : ").append(usbEndpoint.getInterval()).append('\n');
stringBuilder.append(" EndpointMaxPacketSize : ").append(usbEndpoint.getMaxPacketSize()).append('\n');
stringBuilder.append('\n');
}
}
usbDeviceConnection.close();
return stringBuilder.toString();
}