Disable Reset while installing driver USB Serial COM

Status
Not open for further replies.

Ahmad Edi Saputra

Junior Member level 2
Joined
Apr 2, 2015
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
209
Dear All

i need help with these 2 case

1. Can I disable modem reset (DTR pulse) while installing driver usb to serial port? so when i plug usb to serial, pin DTR will always remain low (or high), default instaling usb serial while generate about 3 or 4 pulse on pin DTR.

2. Can I detect usb event plugged/unlpug with java? if not, what programming language should i use?
 

Dear All

2. Can I detect usb event plugged/unlpug with java? if not, what programming language should i use?
I have never attempted to access a USB device in Java but it should be possible
have a look at
http://usb4java.org/index.html

in C++ if you are connecting to a USB HID device you could use the HID API
**broken link removed**

for example, this loops until the device is plugged in
Code:
	// Open the device using the VID, PID,
	while(!(handle = hid_open(0x4d8, 0x3f, NULL)))
        {
		printf("unable to open device\n");
 		Sleep(2000);
	   }
	cout << "USB HID device connected VID & PID OK" << endl;
a run gives
Code:
unable to open device
unable to open device
unable to open device
unable to open device
unable to open device
USB HID device connected VID & PID OK
if using C++, C#, VB.NET etc have a look at
http://msdn.microsoft.com/en-us/library/windows/hardware/ff540174(v=vs.85).aspx
http://msdn.microsoft.com/en-us/windows/hardware/drivers/hid/finding-and-opening-a-hid-collection
 

Java for HID devices
https://github.com/nyholku/purejavahidapi

it is very easy to use - a run of
Code:
import java.util.List;

import purejavahidapi.*;

public class Example1 {

	public static void main(String[] args) {
	    System.out.println("start search for HID devices");
		try {
			List<HidDeviceInfo> devList = PureJavaHidApi.enumerateDevices();
			for (HidDeviceInfo info : devList) {
				System.out.printf("VID = 0x%04X PID = 0x%04X Manufacturer = %s \n", //
						info.getVendorId(), //
						info.getProductId(), //
						info.getManufacturerString());//
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
gives
Code:
C:\temp\jtemp>java -cp .;purejavahidapi.jar;jna-4.0.0.jar Example1
start search for HID devices
VID = 0x04F3 PID = 0x0103 Manufacturer = null
VID = 0x04D8 PID = 0xF4DB Manufacturer = Microchip Technology Inc.

C:\temp\jtemp>
there is also
https://github.com/gary-rowe/hid4java
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…