Coder Social home page Coder Social logo

java-simple-serial-connector's People

Contributors

scream3r avatar

Watchers

 avatar

java-simple-serial-connector's Issues

dll already loaded in another classloader

Hello. I use jssc on my java web app (.war) project on Tomcat7.14. If I deploy 
the only one war - everything is ok. But I can't use jssc in two different war 
projects at the same time, because the second project fells the exception:
java.lang.UnsatisfiedLinkError: Native Library 
C:\.jssc\windows\jSSC-0.9_x86_64.dll already loaded in another classloader

Original issue reported on code.google.com by [email protected] on 21 Mar 2013 at 8:14

serialPort in Thread

jssc 2.5.0 version on Windows 8.

When SerialPort is used in another Thread the port result closed. The openPort 
and setOptions are called into constructor (so in Main Thread). When the thread 
is running and use writeString, throws the exception 

jssc.SerialPortException: Port name - COM5; Method name - writeString(); 
Exception type - Port not opened.
    at jssc.SerialPort.checkPortOpened(SerialPort.java:855)
    at jssc.SerialPort.writeString(SerialPort.java:367)
    at net.dfware.asterisk.cdr2serial.SerialThread.run(SerialThread.java:58)
    at java.lang.Thread.run(Thread.java:722)

The code is attached. It's right? If I open the port in run() method, all work 
fine. 





Original issue reported on code.google.com by [email protected] on 9 May 2013 at 8:13

Attachments:

SerialPortEventListener hangs

What steps will reproduce the problem?
1. initialize a port with socat -d -d PTY: PTY:
2. copy over the Event mask & SerialPortEventListener interface example from 
the projects' site
3. create and start a simple c program which prints data to the serial device 
periodically

What is the expected output? What do you see instead?
Since I modified the example to print out everything (converted to string) when 
the listener enters if(event.isRXCHAR()) I expected output from the running 
java program while the C program is also running (generating input on the port).
What happened instead is that the listener program printed out about 20-30 
events while the C program was still running.

What version of the product are you using? On what operating system?
Ubuntu 12.04
jSSC-0.9.0

Please provide any additional information below:
As I said above I modified the example to:

if (event.isRXCHAR()) {//If data is available
    try {
        byte buffer[] = serialPort.readBytes();
        if (buffer != null) {
            System.out.println(new String(buffer));
        }
    } catch (SerialPortException ex) {
        System.out.println(ex);
    }
}

the rest of the program is unchanged, except that I changed the port name to 
what socat opened (/dev/pts/6).

I also include the C program below, which I used to generate data and sent that 
to the port.

Original issue reported on code.google.com by [email protected] on 18 Dec 2012 at 3:33

It is not possible to specifiy the Listener to remove

The current (v0.9.0) SerialPort provides 
addEventListener(SerialPortEventListener) and a no arg removeEventListener(). 
This is asymetric for an unknown reason, also it permits us to unregister a 
specific listener.

Original issue reported on code.google.com by [email protected] on 29 Oct 2012 at 12:33

JARSigningException: Found unsigned entry in resource: http://127.0.0.1/lib/jssc.jar

1. I download jSSC-Terminal.zip (current version)
2. Copy index.html, lib\jssc.jar, jSSC_Terminal.jar and launch.jnlp on my local 
test site (via easy php : http://127.0.0.1)
3. Execute at this adress index.html

The applet doesn't open and the java console keep getting the error given in 
object. Note : it doesn't change anything if I add "swing-layout-1.0.4.jar" 
neither if i try to sign files with jarsigner.

Operating system : windows 7

Thanks in advance for your help !

Original issue reported on code.google.com by [email protected] on 28 Jun 2013 at 5:30

Feature Request: Access port parameters after a port was created.

What steps will reproduce the problem?
1. Create a port using the constructor.
2. Set port parameters using #setParams(...)
3. No option to access the port parameters on the resulting port instance.

What is the expected output? What do you see instead?
It is helpful to be able to access the port's parameters at a later point in 
its lifetime.

What version of the product are you using? On what operating system?
1.9.1

Please provide any additional information below.
I added an implementation of an extended port as an attachment.  It would be 
good if the parameter access operations (and the toString()) could make it into 
a later release.

The getXxx()-operations allow to access the ports parameters after the port was 
created.

An additional constructor allows to create a port in one step with a number of 
parameters.

#getParameterString() and #createPortFromParameters() allow to read all port 
parameters in a single step and recreate it lateron.  This is used in our 
solution to save thge ports parameters into the Application preferences at 
application end and reopen the port again, when the application is started.

Original issue reported on code.google.com by [email protected] on 3 Aug 2012 at 6:28

Attachments:

Native libs not extracted on Mac OS X with Java 7

The System.mapLibraryName() method returns *.dylib instead of *.jnilib on Mac 
OS X with Java 7.  As a result, the native libs for Mac OS X don't get 
extracted and can't be loaded since the only libs included in the jar for 
mac_os_x use the .jnilib extension.  This can be reproduced by running any Java 
7 project that calls through to a native method in SerialNativeInterface.

What version of the product are you using? On what operating system?
Mac OS X, version 0.9.0

Original issue reported on code.google.com by [email protected] on 6 Mar 2013 at 8:11

Bins folder missing in release

What steps will reproduce the problem?
1. Extract lib
2. Look for "bins" folder or DLL files
3. Look baffled in other older version. :P 

What is the expected output? What do you see instead?
Find "bins" directory.


What version of the product are you using? On what operating system?
2.6.0 and 2.5.0. Older versions not checked.


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 27 Aug 2013 at 1:45

TIOCEXCL on Linux

What steps will reproduce the problem?
1. run your app as user (not root)
2. call getPortNames on Linux
3. try to open any port

What is the expected output? What do you see instead?
Obviously I'd expect the port to be opened, however I get a "port busy".

What version of the product are you using? On what operating system?
This is running on Ubuntu 12.04 LTS.


The issue seems to be that getPortNames (calling getLinuxPortNames) is opening 
the port. When opening the port on Linux, jssc currently issues a TIOCEXCL 
which is never cleared, so remains active after a close ... preventing jssc 
itself to open the port again.

Reproducable by this C program:

  int f = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
  if (f != -1) {
    ioctl(f, TIOCEXCL);
    close(f);
  } else {
    printf("could not open port\n");
  }

Just run it twice.

Original issue reported on code.google.com by [email protected] on 5 Dec 2012 at 6:54

Occasionally losing first character on Mac OS 10.7

What steps will reproduce the problem?
1. I have a java applet that reads barcode scans from the serial Port.  
Occasionally after a page refresh, the first scan will lose the first 
character.  This does not happen on windows 7.

What is the expected output? What do you see instead?
All the characters of the barcode.

What version of the product are you using? On what operating system?
Using 0.9 on Mac OS 10.7.  Have a serial->usb adapter on a barcode scanner.

Please provide any additional information below.
I essentially copied the code from the jssc-terminal demo app, but its running 
against the newest version of the jssc library.  The first character is only 
lost on the first scan on a page refresh, but not on every refresh - its 
intermittent.

I'm setting the parameters the same as jssc-terminal:
        private int baudRate = SerialPort.BAUDRATE_9600;
    private int dataBits = SerialPort.DATABITS_8;
    private int stopBits = SerialPort.STOPBITS_1;
    private int parity = SerialPort.PARITY_NONE;

To open the serial port i run the same code as jssc-terminal.  I've tried 
different types of flow control - having xonxoff off or on, enabling or 
disabling rts and dtr, but that seems to have no effect.

Original issue reported on code.google.com by [email protected] on 13 Apr 2012 at 1:22

Linux Virtual COMs

Try to list the coms on a linux enviroment with SerialPortList.getPortNames()
Virtual COMs will not apear

using 0.9.0

Original issue reported on code.google.com by [email protected] on 28 Mar 2012 at 6:06

OSX mapLibraryName return *.dylib not *.jnilib

SerialNativeInterface init the native library by call System.mapLibraryName, it 
return libjSSC-0.9_x86_64.dylib, I change the file extension from "jnilib" to 
"dylib", so System.load can load the native library

What version of the product are you using? On what operating system?
jSSC: 0.9
OS: OS X 10.8.2 intel
JAVA: Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)



Original issue reported on code.google.com by [email protected] on 20 Nov 2012 at 8:29

OSGi-Bundle

Please Provide a OSGi-Bundle for JSSC and corresponding platform & architecture 
dependent native framgments.

I would propose the bundle name: org.scream3r.jssc
Maybe the packages should be updated also, its uncommon to use a package name 
of one word. Normally the namespace can be mapped to the project homepage eg. 
"org.apache.tomcat"





Original issue reported on code.google.com by [email protected] on 29 Oct 2012 at 10:05

implement write timeout

A write operation is blocking endless when a virtual port is removed during a 
write operation. It unblocks only if SerialPort.closePort() will be called by 
an other thread.

Original issue reported on code.google.com by [email protected] on 29 Oct 2012 at 9:43

SerialPortList not refreshed when a USB serial port is unplugged

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 [email protected] on 6 Jun 2013 at 9:38

MacOSX 10.8.3 will resolve different osName and architecture

What steps will reproduce the problem?
1. run the sample program in mac OSX 10.8.3
2. Unable to link the dynamic library exception thrown.

What is the expected output? What do you see instead?
expected to have map to MacOS

What version of the product are you using? On what operating system?
MacOSX 10.8.3

Please provide any additional information below.

i have found that the resolved name in my Mac OSX 10.8.3 does not exist in the 
osName and architecture if then else loop.

i have to add this two different tags manually in src in order to run it 
successfully, hope this help someone.




Original issue reported on code.google.com by [email protected] on 20 May 2013 at 2:39

Attachments:

Method serialPort.readBytes(byteCount, timeout) always times out regardless of whether data is available in the input buffer.

Method serialPort.readBytes(byteCount, timeout) always seems to timeout 
regardless of whether data is available in the input buffer.

I notice the above method is dependent on getInputBufferBytesCount(). This 
method, at least on the platform and test configuration I'm using, always 
returns zero, regardless of the amount of data in the input buffer.

Operating system: Windows 7, service pack 1, 64-bit
jSSC version: jSSC-2.6.0

For test purposes I have been using Free Virtual Serial Ports from HHD 
software, http://www.hhdsoftware.com/free-virtual-serial-ports. I use two 
virtual serial ports, connected together, forming a virtual bridge between each 
other.


Original issue reported on code.google.com by [email protected] on 6 Sep 2013 at 8:54

waitBytesWithTimeout() silently disposes of InterruptedException

This one is pretty difficult to reproduce, but in our case we have one thread 
that constantly reads from the serial port and the user can cancel reading on 
EDT. 

When the user cancels reading, the thread is cancelled using Future.cancel() 
method. In rare cases this happens in waitBytesWithTimeout() method while 
thread is sleeping. At this point InterruptedException is thrown and it is 
silently disposed of.
This results in thread not being cancelled.

I suggest replacing this whole block:
try {
                Thread.sleep(0, 100);//Need to sleep some time to prevent high CPU loading
            }
            catch (InterruptedException ex) {
                //Do nothing
            }

with the following line:
Thread.yield();

Original issue reported on code.google.com by [email protected] on 11 Sep 2013 at 2:22

Can't select port parameters

I tried this library with a simple example, but I couldn't make it work.

Initially the exceptions raised were related to permissions (both in my app and 
in terminal applet). But then I added my user to the dialout group, and those 
exceptions disappeared. Great. (I think this should be in the docs, btw).

But then the code raised an exception stating that it "Can't set port 
parameters". Using the applet terminal 
(https://code.google.com/p/java-simple-serial-connector/wiki/jSSC_Terminal) 
leads to the same result. So I think the problem is not within my code.

I'm using jSSC-2.6.0 and running ElementaryOS (essentially the same as Ubuntu 
12.04) 64-bit.

The serial port in question is a virtual serial port. I'm using a barcode 
scanner.
When I do a cat /dev/ttyUSB0, works perfectly. The barcodes appear on the 
terminal.
Even minicom works fine.

Any idea on what might be causing this?

Original issue reported on code.google.com by [email protected] on 31 Jul 2013 at 3:41

Garbage results when reading after writing

What steps will reproduce the problem?
I am communicating with custom code written on an Arduino UNO.  When a specific 
byte pattern is sent over the serial port (9600, 8 bits, no parity, 1 stop 
bit), the UNO will read its UUID from EEPROM and write them back over the 
serial port.

I have verified the Arduino is operating correctly by using CoolTerm and 
sending the byte pattern manually.  However when I do the steps in code, using 
JSSC, I get seeming random data back.

This is the code I am using:

> int retVal[] = null;
> byte msg[] = new byte[5];

> msg[0] = 0x48;                // Header 1
> msg[1] = 0x57;                // Header 2
> msg[2] = (byte) deviceID; // Addr
> msg[3] = 0;                   // Length
> msg[4] = 0;                   // Output Mode

> try {
>   this.serial.writeBytes(msg);

>   try {
>       retVal = this.serial.readIntArray(maxLen);
>   } catch (SerialPortException e) {
>       AppLog.get().log("Error reading from device " + deviceID);
>       AppLog.get().log(e);
>   }
> } catch (SerialPortException e) {
>   AppLog.get().log("Error writing to device " + deviceID);
>   AppLog.get().log(e);
> }

If I put a breakpoint on the line that reads "this.serial.writeBytes(msg);" and 
then single step though the code, I get the correct results.  If I run 
normally, or don't put a breakpoint there, then I get seemingly random data 
back.

I have tried putting a Thread.sleep(100) between the write and the read, 
thinking that it might be a timing issue, but that seems to have no effect.

I know that the Arduino is receiving the data correctly, because the other 
commands that don't reply work perfectly.  It is just when I read after writing 
that things go wrong.

What version of the product are you using? On what operating system?

JSSC 0.9, OSX 10.8.2


Any help is greatly appreciated

Original issue reported on code.google.com by [email protected] on 20 Jan 2013 at 1:00

Bluetooth rfcomm0 ports not considered

What steps will reproduce the problem?
1.On a Linux device, define a virtual serial port for a connected Bluetooth 
device using:
rfcomm listen /dev/rfcomm0 channel_number_here
2. Try to get the serial port list using :
SerialPortList.getPortNames();

What is the expected output? What do you see instead?
I was expecting to see the rfcomm0 as part of the serial ports list, but 
unfortunately the rfcomm0 port is missing from the list

What version of the product are you using? On what operating system?
Using jSSC-0.9.0 Release version (21.12.2011)

Linux laptop 3.2.9-2.fc16.x86_64 #1 SMP Mon Mar 5 20:55:39 UTC 2012 x86_64 
x86_64 x86_64 GNU/Linux

Please provide any additional information below.
It will be nice to consider the bluetooth ports too.

Original issue reported on code.google.com by [email protected] on 23 Feb 2013 at 6:49

throw exception instead of return-type boolean

I have a problem with the current release (v0.9.0) of jSSC. 

When I write bytes to the serial port, the method writeBytes(byte[]) returns 
false. This happens very undeterministic (1 of 5 times).

Due to the contract of the method writeBytes(byte[]) I can not identify the 
exact problem. 

The return-type boolean is bad design in this case. I think it is better to 
communicate an error via an checked exception (SerialPortException). The 
advantage is, that the exception can give much more information about the cause 
of the problem.

Also see: 
http://stackoverflow.com/questions/2156033/returning-boolean-instead-of-declarin
g-a-void-type-in-java

There are much more methods with this design problem. I think this should be 
changed in the whole API.

Original issue reported on code.google.com by [email protected] on 2 Jan 2013 at 12:28

Exception in getPortNames() when ports not available

What steps will reproduce the problem?
1. System don`t have any serial ports.
2. Call getPortNames()
3. Application crashes

# Problematic frame:
# j  jssc.SerialNativeInterface.getSerialPortNames()[Ljava/lang/String;+0

---------------  T H R E A D  ---------------

Current thread (0x00000000003ac000):  JavaThread "main" [_thread_in_Java, 
id=12264, stack(0x00000000020d0000,0x00000000021d0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0xffffffff00000002

Original issue reported on code.google.com by [email protected] on 25 Apr 2012 at 11:53

Serial port over USB on Windows: Sysload increases when pulling the USB connection.

What steps will reproduce the problem?
1. Create a connection on a serial port over USB.
2. Use the jsse callback option ( 
serialPort.setEventsMask(SerialPort.MASK_RXCHAR )
3. Connect to a serial port offered over USB.
4. Check sysload using Taskmanager: ~0
5. Pull the USB plug.
6. Check sysload using Taskmanager: The number here depends on the system, 
behaviour is that system load goes up significantly.

What is the expected output? What do you see instead?
Expected is that the system load does not change if the serial port is not 
longer available.

What version of the product are you using? On what operating system?
0.9 on Windows XP

Please provide any additional information below.

I tracked this with a debugger on Java level.  The Java threads seem to be 
cleanly waiting.  When I suspend the thread with the native serial port code, 
system load goes down to zero.  Thus it seems as if there happens some kind of 
busy waiting if the connection gets lost.

Original issue reported on code.google.com by [email protected] on 18 Jun 2012 at 11:58

GLIBC_2.15 not found

We are using jSSC 2.5.0 on Debian Wheezy which has Libc 2.13. 

Creating a new instance of a SerialPort gives this exception:

Exception in thread "Thread1" java.lang.UnsatisfiedLinkError: 
/home/telcred/.jssc/linux/libjSSC-2.5_x86_64.so: 
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by 
/home/telcred/.jssc/linux/libjSSC-2.5_x86_64.so)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1646)
        at java.lang.Runtime.load0(Runtime.java:787)
        at java.lang.System.load(System.java:1022)
        at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:159)
        at jssc.SerialPort.<init>(SerialPort.java:113)


We tried to force jSSC to use a newer libc6 by using libc6-2.15 and libc6-2.17 
from various other sources (add conf to /etc/ld.so.conf.d/ and do ldconfig, run 
JVM with "-Djava.library.path=<path to libc6>") but libjSSC-2.5_x86_64.so 
always looks in only one place for libc.so.6, namely /lib/x86_64-linux-gnu/
We also tried to set the search path with LD_PRELOAD and LD_LIBRARY_PATH 
environment variables but the former just gave an error ("couldn't load 
<libname>, ignoring it") and the latter did nothing at all. Both variables were 
exported OK.

Do you know of any way we could force jSSC to search for libc.so.6 on a custom 
path?

We do not want to upgrade our OS, nor force-update the libc6 used by the OS, so 
the only option for us would be to recompile the jSSC native libs from source 
against libc6-2.13. It would help a lot if we could get hold of the build 
scripts you use. Could you make the build scripts available here?

Original issue reported on code.google.com by [email protected] on 10 May 2013 at 2:06

"Garbage-less" read method that takes a byte array instead of allocating a new one every-time...

While a Java programmer should refrain from thinking too much about
optimizing object/array allocation, in practice the garbage collection pauses
can become a problem which becomes critical in near-real-time applications.
I am building control software for state-of-the art microscopes and try to 
minimize
object allocation, especially when it's nit really necessary.
Java can behave very well for this sort of applications -- reducing object 
allocation is 
an essential trick to achieve that. 
(Imagine an intense serial traffic with thousands of messages per seconds which 
would swamp the GC and make it spend a lot of time cleaning up the mess...)

It would be nice to have the possibility to have a method like this one:

    public byte[] readBytes(byte[] bytes) throws SerialPortException {
        checkPortOpened("readBytes()");
        return serialInterface.readBytes(portHandle, bytes);
    }

which would use an existing array (which implicitly defines a read length)
instead on internally allocating a new array for every read.

Actually I was trying to see if I could make the change myself, and send it to 
you,
but i don't see any makefile for the native code, how do you compile?




Original issue reported on code.google.com by [email protected] on 10 Jun 2013 at 9:47

Incorrect on stack memory allocation

I am not going to provide u with the steps or something like that. 
Just take a look at the following code:

    //since 2.1.0 -> string concat fix
    char portFullName[strlen(prefix) + strlen(port) + 1];

How is that going to work? In C++ you can not allocate the array by this way 
because strlen(prefix) + strlen(port) gives u the correct value on the runtime 
only! At the compiling time the size of the array is not exactly known so that 
memory can not be correctly allocated on the stack.

So u probably need to call alloca here unless your code will corrupt my stack.

Thanks. 

Alexey K.

Original issue reported on code.google.com by [email protected] on 23 Jul 2013 at 10:31

Port List not returning MacOSX

What steps will reproduce the problem?
1. be on Mac OS X
2. if you call serialPortList.getPortNames()
3. it will not return anything because of the file rules it has for returning a 
file

What is the expected output? What do you see instead?
I expected to see ports.  instead I got A zero length array

What version of the product are you using? On what operating system?
0.9  MacOSX

Please provide any additional information below.
It would be helpful if we were allowed to specify the rules for finding ports.
Obviously I just went and found the ports needed myself.

This could also be an improvement for people trying to use a virtual port.

Btw I love this project.  It is very useful and very easy!

Original issue reported on code.google.com by [email protected] on 24 Oct 2012 at 9:25

Attachments:

Detect when port stop sending

Hi,

Currently I'm working on SMS gateway kind of application.
In receiving AT-Command result from port, there are many pattern to capture 
before I start to be able to process the incoming SMS.
Is there any way, I can detect when the port has finished sending byte[]?.

Thanks
Bromo


Original issue reported on code.google.com by [email protected] on 26 Jul 2013 at 6:55

JVM crashes on WinXP

What steps will reproduce the problem?
1. The problem is hardly to reproduce because it occurs only after multiple 
hours (4 - 7 hours).

What is the expected output? What do you see instead?
I expect it to work, but I see a dump file (see attachment).

What version of the product are you using? On what operating system?
I'm using version 0.9 with a fix for Mac OS 10.8. The error occurs on WinXP SP 3

Please provide any additional information below.
The JVM crashes in the SerialNativeInterface.waitEvents() methods. We are using 
the event listener to become notified if there is new data available.
On Mac OS it seems to work fine. This meens until now we did not have the bug 
on Mac OS X :)

Any Idea? Or need additional Information?


Original issue reported on code.google.com by [email protected] on 28 Feb 2013 at 9:52

Attachments:

License clarification

Can you clarify the license?  The web page says LGPL but the distribution 
actually seems to include several licenses.

Original issue reported on code.google.com by [email protected] on 15 Jun 2012 at 12:54

SerialPortList.getPortNames() with no ports on system crashes, returns 1

If I call getPortNames() with no com ports currently created (a common 
situation, where someone forgets to plug in the USB adapter)

the line 

String[] comList = SerialPortList.getPortNames();

forces my NetBeans Platform to close, returning '1'.

Perhaps this isn't quite an issue, but I'm really not sure what it would be 
returning if the list is empty;  it apparently is not a String[].

Original issue reported on code.google.com by [email protected] on 17 Nov 2011 at 6:25

Two SerialPort instances for the same port name

I have 2 eclipse views (ViewPart), one displays sensor data and the other 
displays images.  Can each of view create a SerialPort instance and listen to 
the same port?

View#1 -> new SerialPort("/dev/tty.serial-rn42-RNI-SPP");
View#1 -> new SerialPort("/dev/tty.serial-rn42-RNI-SPP");

Original issue reported on code.google.com by [email protected] on 30 Aug 2013 at 1:20

Not sending data to virtual port

What steps will reproduce the problem?
1. running obdsim on ubuntu 12.04 (port: dev/pts/2)
2. connects to port but no data sent when writing to port
3.

What is the expected output? What do you see instead?
after sending ATZ (AT command) I should see the obdsim reset

What version of the product are you using? On what operating system?
Ubuntu 12.04

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 5 Sep 2012 at 1:46

Feature request: port enumeration on inux

From what I can see, port enumeration seems to use dmesg to find serial ports, 
but the kernel ring buffer can be overwritten.  Can this mechanism be improved 
in some way?

Ideas:

1) explore /sys/class/tty and see if there's a way to figure out which ones of 
those are serial port

2) just make some assumptions based on the device name in /dev similar to what 
you do for SunOS.  If you're on linux, the serial ports are probably all 
/dev/ttyS* or /dev/ttyACM* or /dev/ttyUSB*

Original issue reported on code.google.com by [email protected] on 15 Jun 2012 at 12:56

Detecting port busy is not working as expected

What steps will reproduce the problem?
1. Open the port for device#1 ( USB device that has a virtual port ex: 
/dev/ttyACM0)
2. Open the port/dev/ttyACM0 again, and it succeeds where it should throw an 
exception, and this cause device#1 to stop functioning, and isCTS() starts to 
return "false".

What is the expected output? What do you see instead?
Throw an exception, instead the port is opened successfully

What version of the product are you using? On what operating system?
Version 0.9 , OS: Ubuntu 9.10

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Jan 2012 at 10:14

Port busy when opening serial port on Ubuntu Linux 12.04 LTS

What steps will reproduce the problem?

serialPort = new SerialPort("/dev/ttyUSB0");

the actual usb port name is retrieved in the program via 

String[] portNames = SerialPortList.getPortNames();

which returns the correct port.

What is the expected output? What do you see instead?

jssc.SerialPortException: Port name - /dev/ttyUSB0; Method name - openPort(); 
Exception type - Port busy.
    at jssc.SerialPort.openPort(SerialPort.java:146)


What version of the product are you using? On what operating system?
libjSSC-0.9_X86_64.so, ubuntu linux 64 bit 12.04 LTS, running as normal user 
not root.


Please provide any additional information below.

Code is working fine under windows 7 (64bit) with same USB to serial adapter.
(belkin fsu103v)
I've tried reconnecting the usb/serial adapter with no effect, tried rebooting 
system no effect.

Original issue reported on code.google.com by [email protected] on 18 Aug 2012 at 2:18

JVM Crash (Windows XP) When trying to open serial port

What steps will reproduce the problem?
1. Call serialPortInstance.openPort()

What is the expected output? What do you see instead?
It should work, but instead the JVM crashes.  The real output is attached - 
it's the standard EXCEPTION_ACCESS_VIOLATION.

What version of the product are you using? On what operating system?
Using jssc-0.9 on Windows XP

It's crashing in the open function's JNI code.  I'm not sure how to compile the 
JNI code for windows so I can't really troubleshoot or test, but there is some 
really suspicious stuff in the function, particularly the following:
char prefix[] = "\\\\.\\";
const char* port = env->GetStringUTFChars(portName, JNI_FALSE);
strcat(prefix, port);

strcat should take 'port' and append it to the char* at &prefix[0].  The issue 
is that prefix is a static array on the stack of a certain length.  I expect 
that the access violation happens when strcat tries to copy characters from 
port past the end of the prefix array.

Again, I haven't compiled/tested a fix for this, but I expect that it would be 
to either declare prefix to be a longer static array, say prefix[64] = 
"\\\\.\\", or to declare it on the heap, as preffix = malloc(4+strlen(port)) or 
something.

Let me know if any other info is required.  Not sure how no-one else ran into 
this issue...  Maybe I'm Doing It Wrong?

Original issue reported on code.google.com by [email protected] on 20 Feb 2013 at 7:10

Attachments:

Port opened by other programs then makes that jSSC reads corrupted data.

What steps will reproduce the problem?
1. I run my program and use jSSC without problems.
2. Close port without problems.
3. Open another program that uses the same port.
4. Use without problem.
5. Close port without problems.
6. I open again my program but this time the read data by jSSC are corrupted.
7. Close port and I read the source of información using a type hyperterminal 
program and the bytes sent are correct.

What is the expected output? What do you see instead?
I read bytes corrupted without any pattern of modification.

What version of the product are you using? On what operating system?
0.9.0 - WinXp

Please provide any additional information below
I turn on the PC and I use my program with JSSC. Then use another program and 
when I return to use my program with jSSC I received corrupt data. Restart the 
PC and my program starts running again.

Original issue reported on code.google.com by [email protected] on 4 Nov 2012 at 12:58

Native Library will not link when user_home is read only.

What steps will reproduce the problem?
1. I found this issue on a vmware fusion workstation where the user_home 
variable points at a list of shared folders on the host machine rather than at 
the location of the local windows profile.  This issue is probably caused by 
VMWare fusion, not by Java, because I tried it in both JRE 1.6 and JRE 1.7 and 
both reference a read only user_home.
2. To duplicate it - make the user_home read only.
3. call SerialNativeInterface.getSerialPortNames();

What is the expected output? What do you see instead?
Expected is a list of local ports.  What we get back is an error: 
java.lang.UnsatisfiedLinkError: jssc.SerialNativeInterface.getSerialPortNames() 
at
jssc.SerialNativeInterface.getSerialPortNames(Native Method)

What version of the product are you using? On what operating system?
0.9 on Windows 7 running in a VMWare Fusion VM on Mac OSx Host.


Please provide any additional information below.
The problem is that the serial native interface class attempts to extract the 
library into the user_home.  

First off the class should throw an exception if it cannot extract the library 
and explain the issue so that someone doesn't have to look at the source to 
figure out why a call to a function within the class is failing.  If loadLib is 
false in the static block just before the system attempts to load the native 
library, throw an exception.  Better yet, if the directory is not writeable 
before, throw an exception when that is determined before we even get down to 
trying to load the library.

I suggest as a solution to create a property setter that overrides the 
user_home and allows the implementor to specify an alternate user_home.  That 
is how I am solving the issue for my application - I'm adding a variable and a 
setter for that variable.

I would be happy to contribute my patch, as well as create exceptions as per my 
suggestion above.  

Original issue reported on code.google.com by [email protected] on 10 Feb 2013 at 2:48

Feature Request - Access to More Termios on Linux

I would like access to more of termios on linux-like operating systems.  In 
particular (and to begin) I want access to fields like VTIME and VMIN.

What is the right way to do this so that windows implementations fail 
gracefully?

Original issue reported on code.google.com by [email protected] on 15 Jun 2012 at 2:47

Problem with the readBytes method

What steps will reproduce the problem?
1. Reading one byte from the port with serialPort.readBytes(1);

What is the expected output? What do you see instead?

I had expected that the method would block if no bytes were available.
Instead the method returns the last byte which was received even when no new 
bytes have been received.

What version of the product are you using? On what operating system?
jSSC-0.8 Test Build #3, tested on Linux Fedora 15 and Windows XP.

Please provide any additional information below.
I had a problem with the readBytes method when trying to read only one byte 
with this...

serialPort.readBytes(1);

I had expected that the method would block if no bytes were available but in 
fact it appears that the method returns the last byte which was received each 
time it is called even when no new data was received on the RS232 cable.
I tried my code on Linux (Fedora 15) with an RS232 port on the motherboard and 
to confirm the result I tried on Windows with an FTDI USB-serial adapter. Both 
gave the same result.

The following method I wrote appears to solve the problem.
The method will not return until either
a. A byte is received on the RS232 cable or 
b. The thread is interrupted.

protected byte getByte() throws jssc.SerialPortException {
    while (serialPort.getInputBufferBytesCount() < 1) {
        try {
            Thread.sleep(1);
            if (Thread.currentThread().isInterrupted()) {
                return 0;
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            return 0;
        }
    }
    return (byte)(serialPort.readBytes(1))[0];
}

Should the read bytes method blocked or have I misunderstood how it should work?

Original issue reported on code.google.com by [email protected] on 6 Oct 2011 at 8:11

Include usbmodem in list of serial ports

What steps will reproduce the problem?
1. Attach Arduino UNO to computer
2. Call serial.getPortNames()

What is the expected output? What do you see instead?
device names which start with usbmodem should be included in the list, as well 
as usbserial, and serial


What version of the product are you using? On what operating system?
JSSC 0.9 on OSX 10.8.2


Please provide any additional information below.
in SerialPortList.java#getMacPortNames, the line that reads:

if(!file.isDirectory() && !file.isFile() && 
file.getName().matches("tty.(serial.*|usbserial.*)")){

should be

if(!file.isDirectory() && !file.isFile() && 
file.getName().matches("tty.(serial.*|usbserial.*|usbmodem.*)")){

I presume this applies to Linux as well, but am not in a position to test it at 
the moment

Original issue reported on code.google.com by [email protected] on 20 Jan 2013 at 12:48

Maven repo

Hi! Is it possible to put your library as dependency to Maven central repo? 
That would leverage any development on Java applications using your lob.

Original issue reported on code.google.com by [email protected] on 7 Dec 2012 at 12:52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.