我在USB Host文档的设备过滤器中看到了这个接口子类,但是在UsbConstants文档中也没有定义int。
有两种情况我可以插入USB。
在一个,我的应用程序在开发板的前台运行(运行android 4.x)。 当我插入USB时,我收到了动作
android.hardware.usb.action.USB_DEVICE_ATTACHED然后我打印出我得到的设备界面
Interface: UsbInterface[mId=0,mClass=255,mSubclass=66,mProtocol=1,mEndpoints=[Landroid.os.Parcelable;@418044c0]在另一方面,申请被关闭。 当我插入设备并接受提示时,我收到附加的操作并打印出界面列表,该列表似乎有两个设备
Interface: UsbInterface[mId=0,mClass=255,mSubclass=255,mProtocol=0,mEndpoints=[Landroid.os.Parcelable;@417496c8] Interface: UsbInterface[mId=1,mClass=255,mSubclass=66,mProtocol=1,mEndpoints=[Landroid.os.Parcelable;@417498b0]那么,什么是mSubclass 66(我知道255是UsbConstants.USB_CLASS_VENDER_SPEC ,我认为是我的USB附件),为什么这两种不同的场景会产生两种不同的结果呢?
I see this interface subclass specified in the device filter of the USB Host documentation but the int is also not defined in the UsbConstants documentation.
There are two scenarios in which I plug in USB.
In one, my application is running in the foreground on the dev board (running android 4.x). When I plug in the USB, I receive the action
android.hardware.usb.action.USB_DEVICE_ATTACHEDand I print out the device interface I get
Interface: UsbInterface[mId=0,mClass=255,mSubclass=66,mProtocol=1,mEndpoints=[Landroid.os.Parcelable;@418044c0]In the other, the application is closed. When I plug in the device and accept the prompt I receive the attached action and print out the interface list, which appears to have two devices
Interface: UsbInterface[mId=0,mClass=255,mSubclass=255,mProtocol=0,mEndpoints=[Landroid.os.Parcelable;@417496c8] Interface: UsbInterface[mId=1,mClass=255,mSubclass=66,mProtocol=1,mEndpoints=[Landroid.os.Parcelable;@417498b0]So, what is mSubclass 66 (I know 255 is UsbConstants.USB_CLASS_VENDER_SPEC, which I believe is my USB Accessory), and why do the two different scenarios produce two different results?
最满意答案
因为您的设备的类是特定于供应商的,所以由供应商来定义子类,因此usb.org不会定义任何内容。 如果需要更多信息,可以查找设备的供应商(可以在设备描述符中找到VID中的供应商)。
如果您在打开应用程序时看到其中一个接口丢失,则可能是它已在设备上打开了一个句柄,您无法访问它。
Because the class of your device is vendor specific it is up to the vendor to define the subclass, so there won't be anything defined by usb.org. You should look up the vendor of your device if you want more information (you can find the vendor from the VID in the device descriptor).
If you see that one of the interfaces is missing when your application is opened it's possible that it has a handle opened on the device already and you cannot access it.
更多推荐
发布评论