Hi,I use javax.comm.CommPortIdentifier.getPortIdentifiers() to get a list of the system's serial ports. This works fine, but the list is only updated upon loading of the class CommPortIdentifier (through static code).However, the Java application needs to detect a USB-to-serial converter which is plugged in at runtime. This converter shows up as an additional COM port (we're on WinXP). If it is plugged in before the app starts, it is detected, but not if it is plugged in during runtime.The said static code in CommPortIdentifier is:CommDriver commdriver = (CommDriver)Class.forName("javax.comm.RXTXCommDriver").newInstance();commdriver.initialize();This can be repeated, which does detect the newly appeared COM port, but it only adds to the list of available ports that getPortIdentifiers() returns, so I assume it's not meant to be done.Is there some way to properly refresh the list of system COM ports dynamically?Thanx in advance,J�rg
|
|
0
|
|
|
|
Reply
|
ISO
|
11/23/2007 9:28:22 AM |
|
Jörg Zieren wrote:...>This can be repeated, which does detect the newly appeared COM port, but >it only adds to the list of available ports that getPortIdentifiers() >returns, so I assume it's not meant to be done.Huh? That paragraph seemed entirely logical up till the point "..so I assume it's not meant to be done."Why would you assume it is inappropriate to (for example)start a thread that regularly checks for new COM connections,and update a list(?/whatever) accordingly?-- Andrew Thompsonhttp://www.physci.org/Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
|
|
0
|
|
|
|
Reply
|
Andrew
|
11/23/2007 12:00:45 PM
|
|
Andrew Thompson wrote:> Jörg Zieren wrote:> ..>> This can be repeated, which does detect the newly appeared COM port, but >> it only adds to the list of available ports that getPortIdentifiers() >> returns, so I assume it's not meant to be done.> > Huh? That paragraph seemed entirely logical up till > the point "..so I assume it's not meant to be done."> > Why would you assume it is inappropriate to (for example)> start a thread that regularly checks for new COM connections,> and update a list(?/whatever) accordingly?You're right, I was being unclear - sorry. The problem is that each reinitialization *adds* *all* ports to the list of available ports. So at first there's, say, "COM1 COM2 LPT1". After calling initialize() "manually" for the first time (i.e. for the second time in total), there's "COM1 COM2 LPT1 COM1 COM2 LPT1". And so on, so after n calls to initialize, each port is listed n+1 times.-Jörg
|
|
0
|
|
|
|
Reply
|
UTF
|
11/23/2007 9:32:38 PM
|
|
Jörg Zieren wrote:>> ..>>> This can be repeated, which does detect the newly appeared COM port, but >[quoted text clipped - 7 lines]>> start a thread that regularly checks for new COM connections,>> and update a list(?/whatever) accordingly?>>You're right, I was being unclear - sorry. The problem is that each >reinitialization *adds* *all* ports to the list of available ports. Oh right - I get you now. That is less optimal.>...So at >first there's, say, "COM1 COM2 LPT1". After calling initialize() >"manually" for the first time (i.e. for the second time in total), there's >"COM1 COM2 LPT1 COM1 COM2 LPT1". And so on, so after n calls to >initialize, each port is listed n+1 times...mmm. That suggestion of mine just does not sound 'right'anymore. I better bow out of this thread and hope one of the'Java comm' experts can identify the best strategy.-- Andrew Thompsonhttp://www.physci.org/Message posted via http://www.javakb.com
|
|
0
|
|
|
|
Reply
|
Andrew
|
11/24/2007 4:52:09 AM
|
|
|
3 Replies
105 Views
(page loaded in 0.067 seconds)
Similiar Articles: Need help: OVERRUN error for serial port with Tcl85 but not with ...Hi, I have a script which reads data from the serial port and searches each line ... I just resigned myself to wanking up the system buffer sizing when I find myself ... DS25 and the serial consol. COM1 or COM2 ? - comp.os.vms ...... decides which port > becomes the serial console port. If it's ... few things to look up. > > And it's still a very nice system ... some online place to find firmware update ... Very slow serial port objects - comp.soft-sys.matlab> Hi Rasmus, I've seen behavior like this while using some bluetooth dongles that are presented as serial ports. I would suggest contacting customer support so they ... any port in a storm is fine by me - comp.dcom.sys.cisco... sh ver Cisco Internetwork Operating System ... Async65 (7.7.7.2) 03:37:38: RIP: build update ... Praecis Ct CDMA clock hooked to my serial port, running in pps mode. Here's my ... HP 58503A GPS receiver question - comp.protocols.time.ntp ...... which is connecting the serial port of the HP58503a to the serial port B of the Netra. # ln -s /dev ... Sync system time with GPS ... GPS FAQ GPS (Global Positioning System ... Reset Call Pilot Mini to default - comp.dcom.sys.nortel... Pilot MINI, from serial conection, the system ... conection, the system is corrupted before an electric failure. I=B4m set connect to serial port ... To Change Update Mode ... PROMAC 2A Eprom Programmer - comp.os.cpmY OR <N> > MESSAGE Configuration List Has Changed! > > Update running Program, <W> Write ... Dir highlight color > File color > File highlight color > Serial Port ... Linux 2.6 + PPS + ntpd? - comp.protocols.time.ntpHi, I have a Garmin GPS 25LP that I have connected to a serial port on my linux 2.6 laptop, and I need to get my system's clock synchronized with t... SunFire 280R console and break - comp.unix.solarisDo they have an ALOM card or just serial port access. ... Problem setting up SUN Management Center 3.5 update 1 0 ... Veritas Cluster File System 1 234 sheldonl (3) Solaris console log - comp.unix.solaris... the graphics card and boot through the serial port and ... As part of hardening of the system, we have changed the encryption to 2a. Updating the list of the system's serial portsUpdating the list of the system's serial ports - Java . This is a discussion on Updating the list of the system's serial ports - Java; Hi, I use javax.comm ... Serial port - Wikipedia, the free encyclopediaUpdating Firmware on various consumer devices. Some CNC controllers ... This port is created by software which enable extra serial ports in an operating system without ... 7/25/2012 7:16:32 PM
|