Giter VIP home page Giter VIP logo

usb-device-info---android's Introduction

USB Device Info

Android Arsenal

Android 3.1 introduced USB host mode which allows the user to plug USB devices to your Android tablet in the same way as a Desktop PC and extend its functionality (if the tablet has the correct drivers of course).

This application will provide information about almost all currently plugged-in USB device (see below for more info about the 'almost').

Information includes:

  • The Device class
  • The USB device path
  • The Vendor ID (VID) and the Product ID (PID).
  • A List of all interfaces and their endpoints.

No ads.

Apart from using the build in API it now also parses "/sys/bus/usb/devices/" to display devices which are hidden by the Android OS, although in less detail. This part is also available as a Java library (see Library below)

Important

As of version 2.0.0 SysBusUsbDevice is no longer Parcelable; it is now Serializable. This is so that the library can be used in pure java projects.

Library

The Linux part of the project is available as an artifact for use with Gradle/Maven. To use that, add the following blocks:

gradle

	repositories {
		maven {
			url "https://dl.bintray.com/alt236/maven"
		}
	}

	dependencies {
		compile 'uk.co.alt236:usbdeviceenumerator:2.0.0'
	}

maven

    <dependency>
      <groupId>uk.co.alt236</groupId>
      <artifactId>usbdeviceenumerator</artifactId>
      <version>2.0.0</version>
      <type>pom</type>
    </dependency>

Notes

  • If you download the accompanying databases, the application will also be able to provide you with additional info such as the Vendor of the device (which is not necessarily the brand!), the vendor's logo and the product name.
  • As this application is using the default Android API some devices might not appear. USB Hubs (and devices connected to them) are invisible event though they seem to function properly, and mice seem to be filtered out of the provided list. I'm looking into ways to fix this.
  • Device Subclass resolution will be added in the next version.
  • The database is parsed from: http://www.linux-usb.org/usb.ids
  • SELinux can interfere with accessing sysfs which will block the Linux part of the app from working.

Changelog

  • v0.0.1 First public release\n
  • v0.0.2 Added Interface and Endpoint resolution\n
  • v0.0.3 Databases can now be downloaded.\n
  • v0.0.4 Now also parses /sys/bus/usb/devices/ for those pesky devices android hides. Added export.
  • v0.0.5 Added support for small screen devices. Bugfixes and stability improvements.
  • v1.0.0 Materialise design, better tablet support, code overhaul
  • v2.0.0 Added debug screens, SysBusUsbDevice is now Serializable instead of Parcelable
  • v2.0.1 Switched to HTTPS, now using internal storage instead of external.

Permission Explanation

  • ACCESS_NETWORK_STATE: Used to check if the device is on-line and using which interface.
  • INTERNET: Used to go on-line and download the updated database.
  • WRITE_EXTERNAL_STORAGE: Used to write the database to the SD card.

Links

Credits

Author: Alexandros Schillings.

All logos are the property of their respective owners

The code in this project is licensed under the Apache Software License 2.0.

Copyright (c) 2020 Alexandros Schillings.

usb-device-info---android's People

Contributors

alt236 avatar rexut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usb-device-info---android's Issues

NullPointerException

//package name: aws.apps.usbDeviceEnumerator
//version: 1.0.0
java.lang.NullPointerException
at aws.apps.usbDeviceEnumerator.ui.progress.ProgressDialogFragment.setTitle(ProgressDialogFragment.java:48)
at aws.apps.usbDeviceEnumerator.ui.progress.ProgressDialogControl.updateProgress(ProgressDialogControl.java:37)
at aws.apps.usbDeviceEnumerator.ui.dbupdate.FileDownloadTask.onProgressUpdate(FileDownloadTask.java:137)
at aws.apps.usbDeviceEnumerator.ui.dbupdate.FileDownloadTask.onProgressUpdate(FileDownloadTask.java:21)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:647)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

how to control linux USB?

hi, this is a bit unrelated to your project -- how do i control a USB device (Arduino Uno R3) from the linux side? it does not show up on the android side on a phone (Micromax, running KitKat 4.4.2) but it does power up (USB host mode?) and is recognized on the linux side. strangely this seems to be a problem with phones (i tried a few others), NOT with tablets, i'm able to control the arduino as a serial device using UsbManager. rooting the phone cannot be part of the solution.

here's the info your .apk generates:
"Device Info
Device Path: /sys/bus/usb/devices/1-1/
Device Class: Communication Device (0x2)
Vendor ID: 2341
Vendor Name (reported): Arduino (www.arduino.cc)
Vendor Name (from DB): Arduino SA
Product ID: 0043
Product Name (reported):
Product Name (from DB): Uno R3 (CDC ACM)

Additional Info
USB Version: 1.10
Speed: 12
Protocol: 00
Maximum Power: 100mA
Serial Number: 7493730393635180E122"

The USB Host Controller app (https://play.google.com/store/apps/details?id=hu.sztupy.android.usbhostcontroller&hl=en) gives the following information:

"USB Host Mode API
supported?

usb host controller v 0.44
Usb Host Controller
Version number 0.44
S3C USB Host driver NOT found!

Root hub present, USB Host mode is active!"

i've no problems with a Tesco Hudl tablet (Jellybean 4.3.2, this is a UK low-mid end tablet) and a Samsung tablet (running KitKat 4.4.2). i'm able to send data from both of these tablets to the arduino as a serial device (57600 baud rate, 8, N, 1) and it does what i want . i only need to SEND it data, no need to read data from the arduino. the code used is essentially from android.serverbox.ch/?p=549. any pointers would be very, very, very helpful. thanks!

Can i Use this plugin with unity android?

I need to get the path of usb in my android game. Can this plugin help with that??

If yes, can you tell me how do I implement this with my game in c# unity?

I am not trained with java. It will be kind of you to help me with this. Thanks in advance

Hi, is there some questions

When I use a usb storage, it has device info under api, but has nothing under linux
I want to know, why doesn't it have ๏ผŸ
And I got a other usb equipment (not a usb storage), it has 3 devices under linux
"/sys/bus/usb/devices" is what ? How can we read files from the usb equipment, is there any path ?

App crash if dir.getFiles returns null - Nougat

ava.lang.RuntimeException: Unable to start activity ComponentInfo{aws.apps.usbDeviceEnumerator/aws.apps.usbDeviceEnumerator.ui.main.MainActivity}: java.lang.NullPointerException: Attempt to get length of null array
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException: Attempt to get length of null array
at uk.co.alt236.usbdeviceenumerator.sysbususb.SysBusUsbManager.populateList(SysBusUsbManager.java:77)
at uk.co.alt236.usbdeviceenumerator.sysbususb.SysBusUsbManager.getUsbDevices(SysBusUsbManager.java:61)
at aws.apps.usbDeviceEnumerator.ui.main.MainActivity.refreshUsbDevices(MainActivity.java:203)
at aws.apps.usbDeviceEnumerator.ui.main.MainActivity.onCreate(MainActivity.java:132)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
... 9 more

how to debug app?

As the app requires a USB device, so emulator cannot be connected to USB device. Then, if I run the app with my android phone, usb still cannot be connected as I already plug in the cable from PC to my phone.. Do I need to buy a usb cable that have many branch for phone? or is this impossible.?

Detection of USB

Your app is working fine on my tablet as well as my mobile. I'm trying to do same thing (to detect usb) in other app but it is not working. I browsed through your source code and found that you are using "usbMan = (UsbManager) context.getSystemService(Context.USB_SERVICE);" I'm doing same thing but its not working. What may be cause?

USB recognized in Linux??

I'm using a nexus 7 (version 4.4.4) and my USB port stopped working properly a few days ago and I downloaded the USB device Info to troubleshoot

My USB devices (connected via 2 separate OTG cables... One brand new) don't show up in the android section, but even when nothing is plugged in I see "usb1" under the Linux tab. When I click it the app freezes

Any idea why the application would not detect devices (phone, camera or thumb drive) or how I can troubleshoot?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.