Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerialPortList not refreshed when a USB serial port is unplugged #40

Closed
GoogleCodeExporter opened this issue Dec 20, 2015 · 4 comments
Closed

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. jSSC-2.6.0 
2. Plug a USB device (with usb/serial bridge)
3. call SerialPortList.getPortNames()
4. Open USB COM port and add a SerialPortEventListener (...do my code)
4. UnPlug USB device
5. call again SerialPortList.getPortNames()

What is the expected output? What do you see instead?
It seems that when i try to get an updated list of available COM ports this may 
not be updated when I remove the USB device.

What version of the product are you using? On what operating system?
jSSC-2.6.0 - Windows XP 32bit


Original issue reported on code.google.com by lciu...@i-piu.it on 6 Jun 2013 at 9:38

@GoogleCodeExporter
Copy link
Author

In Windows jSSC take port names from registry: 
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM\ If jSSC return list with 
unpluged port name, it's mean that this port name present in registry. It can 
be a problem with USB->Serial adapter driver. Try to close the port before 
after step #4 and try again. May be driver cannot unregister device if it busy.

Original comment by scream3r.org@gmail.com on 7 Jun 2013 at 4:43

@GoogleCodeExporter
Copy link
Author

It's true, if the COM port is closed before i try to unplug the USB device, 
SerialPortList.getPortNames() return an updated list.

But, if i remove "brutally" the USB device when a SerialPortEventListener is 
still running (the COM port is always busy)... after i'm unable to close the 
connection.

This is the exception: setEventsMask(); Exception type - Can't set mask.

it is possible to handle this type of event?

Original comment by lciu...@i-piu.it on 7 Jun 2013 at 9:11

@GoogleCodeExporter
Copy link
Author

You can't close port if device phisically removed from system, because port 
handle at this moment incorrect. You should close port before removing of 
device. It's a bad practice - remove device while working.

Original comment by scream3r.org@gmail.com on 7 Jun 2013 at 10:09

@GoogleCodeExporter
Copy link
Author

Original comment by scream3r.org@gmail.com on 21 Jun 2013 at 5:49

  • Changed state: Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant