Connect to hardware device attached with USB cross platform - java

I have hardware a plotter machine. This device doesn't have any kind of driver. When I attached USB cable of this hardware to my machine(windows) it comes under "unspecified device" in control panel -> printers and devices. I want to build an application which can connect to this hardware (plotter without driver) connected via USB. I have checked with usb4java but it din't work. Can you guys please help me. ?
My application must be able to run in any platform, so in any machine I can just attached usb cable and my application must be able to detect the hardware and able to get connection.
Thanks.

You should also try asking the manufacturer for the device's Windows drivers.
If the device doesn't have any Windows drivers, without knowing anything about your device, I would suggest that you use Zadig to attach WinUSB (Microsoft's generic USB device driver) to your printer. Then you can use libusb to write a cross-platform application that detects the machine and talks to it.
However, it might be that your device actually belongs to particular USB device class, such as the CDC ACM class. In that case, it would be better to install the drivers for that particular class. You can get your driver's descriptors using the Linux lsusb utility and examine them to see what class your device is.

Related

How can I know that some devices have been connected with my computer?

I want to monitor whether a device has been attached to my computer. I can monitor it at Control Panel\Hardware and Sound\Devices and Printers. But how can I get this info in my Java code?
The device is been attached with USB port and it's a keyboard and mouse simulator. I use it to remote control other computer
you need some native libraries to do that. try
http://code.google.com/p/javahidapi

Detecting if a mouse is wireless

I am trying to detect whether a wireless mouse is present on a computer. I would like my program to run in the background. I would prefer to do this in Java however if this goes beyond Java's capabilities I can use another language.
Can someone please get me started?
(This seems like a Google-able question but I cannot find anything)
This is beyond Java and is highly OS-specific. You have to query the appropriate device drivers for the operating system; for example, on Linux this would mean looking up information in the evdev system. Note that the particular "type" of wireless will matter a lot, and you may not be able to tell in any reliable way. For example, a Bluetooth mouse is always wireless, but some wireless devices connect with a USB dongle and may not be distinguishable from a wired USB device.

How can I communicate with a printer via USB using java in windows platform

How can I communicate with a printer via USB using java in windows platform? I don't want to use JNI. I want to use jsr80 or libusb-win32 if any experienced have work with that please share his/her knowledge with some code. I think in libusb-win32 java wrapper must install some driver, correct? I don't want to use any driver. I want to designing my application like plug and play type device by which I can send file easily. I don't want to buy any software.
Is there any other way to communicate with printer?
To communicate with most usb devices a driver is required. In most cases though the driver should already be installed on the target pc unless this is a remote printing application. Also most printer drivers are free so you shouldn't need to buy anything.

how can I detect and display all hardwares of a computer using java program?

Is there any way to detect hardwares plugged to a computer using java?For example,The program will be able to detect if a usb mouse is connected immidiately and show a message that an usb mouse is connected.
it is not possible with pure java. but you can use a native lib available on all important platforms, e.g. SIGAR lib from hyperic hq
This depends very much on the plattform your programm is running on.
in linux you can use the dbus api to register hardware changes
if you are only interestet in usb devices you should have a look at jusb (afaik there is even a windows port)

Control a desktop application using an android phone

I want to build an application where an android phone would control a desktop application.
I only need to send coordinates from the phone to the desktop when user's finger is on the phone screen.
But I am kinda confused on the networking side if i should use bluetooth, usb, or wifi (intranet).
I did some research on bluetooth, doing bluetooth socket programming on an android phone shouldn't be a problem, but on the desktop side there are only a few free SDK/library. any suggestion on what to use?
If I were to use USB/cable, What API on the android side I need to use?
I am actually more familiar with general socket programming (wifi), but I think it's going to be slow (correct me if Im wrong) so this would be my last option.
PS: I am using Java for the desktop application too
any suggestions on what method to use? or even maybe I should use .net on the desktop side?
Thanks
You might find the open source RemoteDroid app to be useful in creating your app. It may even do everything that you want.
The source code is here. You may need an svn client like TortoiseSVN in order to download it.
Wifi is probably the most supportable.
Bluetooth requires hardware and drivers on the PC side
USB would ordinarily seem like the most sensible if the wire isn't a problem, but the catch is that it requires that the user enable "USB debugging" on the phone, and have either the android SDK or equivalent functionality to the adb forward command installed, plus a compatible USB driver for the phone. If all that were the case, you'd just forward a port from the PC to the phone and have a pc program connect to that port on the loopback interface which will be forwarded to a service running on the phone.
It's possible you could do something piggybacked on the USB tethering capability of more recent releases to get you a network-over-usb that you could use to connect programs on the PC and phone, but you'd need modified PC drivers so that you don't actually push the PC's internet traffic through the phone (unless you mean to tether as well).

Categories

Resources