getDeviceList() always empty

后端 未结 2 1198
眼角桃花
眼角桃花 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<String, UsbDevice> devicelist = usbManager.getDeviceList();
      Iterator<UsbDevice> 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.

    0 讨论(0)
  • 2021-01-06 08:40

    The Arduino board needs a driver which needs to be installed before it can be accessed.

    I am not sure if you have a port of the driver for Android.

    Edit:

    Also check out this answer in another thread.

    0 讨论(0)
提交回复
热议问题