java - Why my usb to serial port is not recognized in Ubuntu? -


i have continue development of specific java embedded project talks serial external devices.

previous development done using windows , try run using ubuntu. have port issue when using code:

    string comport = gateway.config.gethardwarerevision() <= 1 ? "com0" : "com1";      string ports = system.getproperty("microedition.commports");     log.log("---available ports: " + ports);      serial = (commconnection) connector .open("comm:" + comport + ";blocking=on;baudrate=" + baud_rates[baudrate]                     + ";autocts=off;autorts=off");     instream = serial.openinputstream();      outstream = serial.openoutputstream(); 

basically connect usb serial cable, noticed ubuntu assigning port /dev/ttyusb0 change code to:

    `string comport = gateway.config.gethardwarerevision() <= 1 ? "/dev/ttyusb0" : "com1";` 

because hw revision <=1 should load port. unfortunately after many tries still receive:

could not find serial port /dev/ttyusb0 java.io.ioexception: gnu.io.nosuchportexception     @ javax.microedition.io.serialconnection.open(serialconnection.java:57)     @ javax.microedition.io.serialconnection.<init>(serialconnection.java:19)     @ javax.microedition.io.connector.open(connector.java:43)     @ javax.microedition.io.connector.open(connector.java:13) 

i read have use rxtx if developing linux can't believe should rewrite java code because change dev environment.

do have ideas make work without refactoring?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -