My device canact as both host and client.how to find whether it is acting as host or c开发者_JAVA技巧lient.?
Generally speaking USB Host and USB client are two completely separate physical layers and they are not mutually exclusive, so your device could very reasonably be both at the same time. If you plug in a client device like a USB Disk or keyboard, the host driver is going to load up and the device manager is going to send out a notification which your app can get by calling RequestDeviceNotifications.
As a client I'm not certain if the device manager sends out a notification (I've never tried it), but it's certainly a possibility worth looking at. if not, then I'd look at the client driver code and see where it's handling the "plugged in" interrupt and probably add a named event (if one isn't already there) that your app can catch.
精彩评论