I am connecting a USB device I built (dsPIC33E powered) to a generic 7" A13-MID android.
I am using ADB over TCPIP with LogCat running.
When I plug in my device I get this in LogCat:
I/USB3G (90): event { 'add', '/devices/platform/sw_hcd_host0/usb1/1-1', 'usb', '', 189, 7 }
I/USB3G (90): path : '/sys/devices/platform/sw_hcd_host0/usb1/1-1'
I/USB3G (90): VID :size 5,vid_path '/sys/devices/platform/sw_hcd_host0/usb1/1- 1/idVendor',VID '04d8'.
I/USB3G (90): PID :size 5,Pid_path '/sys/devices/platform/sw_hcd_host0/usb1/1-1/idProduct',PID '003f'.
I/USB3G (90): cmd=/system/etc/usb_modeswitch.sh /system/etc/usb_modeswitch.d/04d8_003f &,
I/USB3G (90): excute ret : 0,err:No such file or directory
I have MissileLauncher Demo running in debug mode ADT.
I can set a breakpoint in Fire and when I press Fire button, the code breaks there (so debugging IS working).
I have set Product-ID and Vendor-ID to the correct values in device_filter.xml.
I then set a breakpoint here:
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) {
setDevice(device);
} else if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) {
if (mDevice != null && mDevice.equals(device)) {
setDevice(null);
}
}
When I step through the code after the break, the intent. line is executed but the following if statement is not entered and setDevice(device)
is never called (neither is setDevice(null)
).
I did expect setDevice(device) to be called. After all, I have the device plugged in, the android saw that I plugged it in (see LogCat above) and I have the device_filter.xml set correctly.
What am I missing?
Other info, an app I installed 'USB Device' sees the device but lists it under the Linux tab. I hope that is not bad news for me!
Thanks, Dale
I tried to enumerate the devices individually but no 'Yeah' (in fact there were no devices returned in HashMap):
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
while(deviceIterator.hasNext()){
UsbDevice device1 = deviceIterator.next();
//your code
if (device1.getVendorId()==1240) {
savetofile("Yeah!");
}
}
Not sure if this is relevant or not but the android is rooted and it came that way.