Java: Get USB Mass Storage Device Information - java

is there a possibility to get USB mass storage information like the serial of an USB device in Java on Windows?
I tried to achieve that with USB4Java (low and high-level API) and it works, but the problem is that I have to install a customized driver to get access to the information from my Java app (described in the FAQ at http://usb4java.org/). When that special driver (created with Zadig) is installed I don't have any further access to the device from the Windows explorer (just from my Java app).
I would like to detect when a new USB device is attached and if it was attached, I would like to get some information like the serial number of the device, the device name, the drive letter that was assigned etc.
That app should be used by other users and I couldn't force them to create a customized driver for each device ...
Do you have any hints how to achieve that?
Thanks.
Edit: Is it possible to get the usb-port of a connected device with Java-built-in methods?
I've tried sth with FileSystemView.getFileSystemView().getSystemDisplayName() but there are no such options. Is there another possibility to get vendor id's or sth. similiar with Java?
Or is it possible to get the drive letter with USB4Java?
Thanks.

Related

How to access directly internet on WearOS app

I am looking for My data on wear OS app to send to my external apache server with php and mysql.
Ultimately I need watch sensor data in MySQL database, So i created a POST request page using php. How do I send POST request?
Note: I am not using mobile phone between WearOS app and My server. WearOS is connected to internet via WiFI
Please if you know any solution help me
FYI: I tried basic things given at https://developer.android.com/training/wearables
Using Smart Watch with API level 23
Regards
Unfortunately your watch system version is too old. I strongly recommend you to buy a new watch or try update to Wear OS 2.x (API25) if your device is still under maintain.
If you insist on using current device the only way to access the Internet is via mobile phone. You can not send HTTP requests directly.
But the old version system should not be able to connect the WiFi. Please confirm your version at first. If your API level equal or larger than 25, you can access the Internet as same as phone using OkHttp or others you like.

How do I detect the COM port number of a usb dongle?

I have created an application which sends SMS using Java.
Whith this, I must enter the com port number of dongle manually to code segment.
I would like to do this automatically using code.
How can I do this?
You may want to have a look at jUSB, which provides an API for USB programming. Get a Host from a HostFactory, iterate over it's Buses, and walk the device tree (you can get the number of devices from each Device, #0 is usually the device itself). Then you just need to find out what kind of Configuration your device has and search by that.

How to generate specific IDs for USB ports in Java?

I am developing an application using Java. I am connecting 10 USB devices through external USB ports. I want a specific ID when I connect a device with a specific port. So, for example, if I connect a device on 10th port, I should get a specific ID for that port; which will help me in showing that device in 10th position only. I tried Jusb and other similar third party APIs but they didn't work out. Please suggest some techniques to accomplish this.
Did you tried The JSR-80 API (javax.usb) as explain here http://www.ibm.com/developerworks/library/j-usb/index.html

Send SMS using phone from computer

I need my computer program to be able to send and receive SMS messages. The software has to run independent of the Internet so using a web based SMS gateway is not the solution.
The software should be running from a linux or a Windows machine. Windows is more important for my usecase. My program is in Java but I guess there may be solutions independent of the programming language.
I am considering one of the following options.
Kannel http://www.kannel.org/ Although supported for Linux I guess I could find a way to compile it in windows like done here: http://www.ddj.co.za/kannel-for-windows
The other one seems a more lightweight option http://smsj.sourceforge.net/
Which of these or something else that you have in mind could be a better way of sending SMS via computer without an internet connection?
I am considering using these libraries so I don't have to program all the AT Commands.
Also how do I connect my phone to the computer? For example will it be fine if I just connect my phone with a USB cable when using kannel.
Update:
I need to use simple GSM phones and not depend on IOS or Android specific features.
Perhaps not want you needed or wanted, but maybe useful for others: When I had my iPhone jailbroken there was an Cydia app I used to send SMS from my computer through my phone, BiteSMS.
You had to ssh in and then something similar to:
/Applications/biteSMS.app/biteSMS -send -carrier 077xxxxxx “The message goes here”
Obviously you replace 077xxx with the number you want to send to.
It looks like it is fairly similar process with Android, check out this question on doing this through Android. Again this requires a ssh connection to the phone. Also have a google on 'Sending sms from commandline' there are other resources available.
As for other methods, I can't see any viable options without attaching a phone to your computer and accessing the OS and ssh seems the easiest way to do this.
Try smslib.org + some GSM modem.

Detected android device connected to PC

I have an android devic, i wish to know when it is connected to the pc via java/.net
i know its possible - the Samsung New PC Studio is doing it, when ever i connect an android device it lets me know. how can i achieve the same?
You have to listen for one of this notifications
http://developer.android.com/reference/android/content/Intent.html
If you're using it as a mass storage device then use this
http://developer.android.com/reference/android/content/Intent.html#ACTION_UMS_CONNECTED
Other USB events aren't clearly described in the documentation
EDIT:
If you want to read on the computer side I would read this article
http://today.java.net/article/2006/07/05/java-and-usb
and then check which kind of devices are connected to the usb port. if it is a mobile phone, then you can try to send a short message to it. on your phone you make a small piece of code which returns an appropriate answer so you can detect thats its really android/your phone/this phones you want to identify
java device detection
This site have a guide on how to detect device with java web and java core
http://51degrees.com/Support/Documentation/Java/GettingStarted.aspx

Categories