getDeviceList() always empty

后端 未结 2 1213
眼角桃花
眼角桃花 2021-01-06 08:12

I\'m trying to use an Arduino Board along with my Odys Neo x8 tablet but it seems, that the UsbManager doesn\'t recognize the device alright. I connected the arduino to the

2条回答
  •  时光取名叫无心
    2021-01-06 08:32

    I have used the following code which works very fine with keyboard, mouse and Mass Storage device to connect with Pandaboard,

      UsbManager usbManager = (UsbManager) getSystemService(USB_SERVICE);
      HashMap devicelist = usbManager.getDeviceList();
      Iterator deviceIterator = devicelist.values().iterator();
    
      while(deviceIterator.hasNext()) {
        UsbDevice usbDevice = deviceIterator.next();
        Log.i(Log_Tag, "Model     : " +usbDevice.getDeviceName());
        Log.i(Log_Tag, "Id        : " +usbDevice.getDeviceId());
      }
    

    This should work with Arduino too.

提交回复
热议问题