Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDeviceList empty #349

Open
aprldntm1234 opened this issue Feb 16, 2022 · 2 comments
Open

getDeviceList empty #349

aprldntm1234 opened this issue Feb 16, 2022 · 2 comments

Comments

@aprldntm1234
Copy link

I developed a program using this library.
HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
Log.d("usbDevices_log", usbDevices.toString());

where usbManager.getDeviceList(); When I output the value as log, it came out empty.

Is there no solution? For reference, the current version is 5.1.1 Lollipop.

image

@davdavcoco
Copy link

hey, did your problem solved?

@eclectice
Copy link

eclectice commented Nov 4, 2022

The UsbManager.getDeviceList() method is a standard USB-Host method in Android. So it's not the felHR85-UsbSerial library's fault.

Returns a HashMap containing all USB devices currently attached. USB device name is the key for the returned HashMap. The result will be empty if no devices are attached, or if USB host mode is inactive or unsupported.
Requires the PackageManager#FEATURE_USB_HOST feature which can be detected using PackageManager.hasSystemFeature(String).

Did you use an Android emulator that Android Studio provided to run your app? In that case, It is not supported.

https://developer.android.com/studio/run/advanced-emulator-usage#limitations

Some non-standard Android devices require OTG support to be enabled (in their setting) before using any USB serial adapter.

If you don't attach any USB serial adapter, the UsbManager.getDeviceList() method will return an empty list.

Other than that, try to check USB Host support for your hardware device with this app from Google Play Store: https://play.google.com/store/apps/details?id=eu.chainfire.usbhostdiagnostics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants