Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

External Hardware Info

is there is any possibility to check what are the external hardware where connected in computer

Getting the status of each hardware is online or offline

like image 299
Bucks Avatar asked Oct 06 '22 08:10

Bucks


2 Answers

You may have to take help of linux kernel so I think just execute one simple command that can give you list of devices connected to your device

Here it is

Process process = Runtime.getRuntime().exec("cat /proc/devices");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));

or you can use udevinfo I dont know in details about it but google is there for you

like image 163
Vishal Pawar Avatar answered Oct 17 '22 18:10

Vishal Pawar


If you have honeycomb or above use the USB Manager Service

    UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
    HashMap<String, UsbDevice> devices = manager.getDeviceList();
like image 2
Code Rebel Avatar answered Oct 17 '22 16:10

Code Rebel