Android Tutorial Android Usb Host Tutorial - AdbTest

Status
Not open for further replies.

ppgirl

Member
Licensed User
Longtime User
Hi Erel,

I am working a prject for porting " Universal Serial Bus Mass Storage Class Bulk-Only Transport" to android host.

As those document , MSC need a error recovery if transport error -

"Reset Recovery
For Reset Recovery the host shall issue in the following order: :
(a) a Bulk-Only Mass Storage Reset
(b) a Clear Feature HALT to the Bulk-In endpoint
(c) a Clear Feature HALT to the Bulk-Out endpoint
"
and I can write (a) with
connection.ControlTransfer(manager.USB_DIR_OUT,255,0,iNo,Null,0,10)

but I don't know how to write (b) and (c)
The library has not way to clear endpoint STALL status. Can you help me?

br,
Yang
 

Arf

Well-Known Member
Licensed User
Longtime User
I've just had a tinker with this example as I ned to start work on an app that connects to a PIC micro based HID device by USB from and Android host.
I can see my Google Pixel has enumerated the device as I see the LEDs flashing as they should on my device.
The example code fins the device, but crashes on:

B4X:
'Iterate over interfaces
        For a = 0 To ud.InterfaceCount - 1

I can see the problem is the mInterfaces is null:


The Log window shows this info:
(UsbDevice) UsbDevice[mName=/dev/bus/usb/001/004,mVendorId=1240,mProductId=60,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=Microchip Technology Inc.,mProductName=USB HID Bootloader,mVersion=0.02,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@106f7d0,mConfigurations=[
UsbConfiguration[mId=1,mName=null,mAttributes=192,mMaxPower=50,mInterfaces=[
UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=3,mSubclass=0,mProtocol=0,mEndpoints=[
UsbEndpoint[mAddress=129,mAttributes=3,mMaxPacketSize=64,mInterval=1]
UsbEndpoint[mAddress=1,mAttributes=3,mMaxPacketSize=64,mInterval=1]]]]

Does anyone have any ideas? The device is an old device that's USB has always just worked fine with all PC. Thanks
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…