Giter Site home page Giter Site logo

rishigupta12 / serialpundit Goto Github PK

View Code? Open in Web Editor NEW
125.0 19.0 56.0 173.4 MB

Serial port communication in Java - FTDI D2XX, HID API, X/Y modem

License: GNU Affero General Public License v3.0

C 3.52% Makefile 1.13% Shell 6.90% Java 29.02% Batchfile 0.04% HTML 58.48% CSS 0.75% M4 0.16%
rs232 baud-rate uart usb-hid usb-uart serialport hid serial-port

serialpundit's Introduction

SerialPundit : Serial port communication and much more...

SerialPundit is a Software Developer Kit (SDK) for serial port and HID communication. It has been ported to Linux, MAC, Windows and embedded SE Linux platforms for both 64/32 bit architectures.

It is powerfully configurable for both poll and event driven application designs be it low volume low frequency data or high volume high frequency data.

It eliminates the complexities of serial port programming for different operating systems, allowing engineers to concentrate on their application logic, facilitating faster engineering and development, reducing development cost and time to market.

It is consistent, portable, efficient, testable, reliable, extensible and modifiable.

USB module features

  • USB Hotplug notification; calls listener whenever a USB-UART/HID device is added/removed.
  • Find COM port assigned to a USB device dynamically from USB-IF VID, PID and serial number.
  • Find information about all USB devices connected to system.
  • Custom baud rate setting and high baud rates (3 Mbps) settings supported.
  • USB power related information reporting like selective suspend or auto suspend.
  • Adapt application behavior based on firmware identified on USB device.
  • Statically find if a particular USB device is connected to system or not.
  • List all USB-HID devices connected to system.

Serial port module features

  • Communication

    • Access to EIA232 standard DTR, CD, CTS, RTS and DSR signals.
    • Hardware and software flow-control options.
    • Both polling based and event listener based data/event read supported.
    • Parity and framing errors reporting supported.
    • Break condition send and receive API.
    • ARM Primecell AMBA compliant UART supported.
    • Standard and custom baud rates support.
  • File transfer protocols

    • X/Y modem FTP API implemented with finite state machine.
    • Progress listener for GUI applications (number of blocks, percentage, file name etc.).
    • Both text and binary mode transfer can take place.
    • Abort command support to cancel transfer at any time by sender or receiver.
    • Send and receive in files in parallel in various format and multithreading handling.
  • Vendor libraries integration

    • Vendor libraries like D2XX from ftdi, SimpleIO from microchip, USBXpress from silicon labs etc supported.
  • Others

    • Application specific parameters tuning for performance with and without modification of drivers.
    • Java NIO direct byte buffer API for faster data transfer.
    • IOCTL calls for GPIO control and power management.
    • Find which driver is driving a particular serial port (adapt to system).
    • Completely port reentrant, allowing it to be time sliced.
    • Extraction of shared libraries at user defined locations for isolated environment and security.
    • Input and Output byte stream (blocking and non *blocking) for serial port communication.
    • CRC and other utility class for common functions for quick application development.
    • Optimized read and write methods for single byte, multiple byte or string sending/receiving.
    • Fast set/unset break condition for DMX512 based devices to control stage lighting and effects.
    • OSGI budles can be created easily for integrating in existing OSGI based application.
    • Two lock concurrent queue algorithm based ring buffer for faster data/event processing.
    • Easily integrate into existing application server software like Apache mina for cloud and IoT etc.

HID module features

  • HID class API for communicating with USB-HID devices like MCP2200, CP2110 etc.
  • Dynamically find HID devices or get hotplug event notifications.
  • Input report listener for asynchronous operations.
  • Feature report, input report and output report in raw format available.
  • Find information like serial number, product name, manufacturer etc.

The project is :

  • Functional, stress, stability, unit tested (Junit for continuous integration).
  • Maven repository release for maven integration.
  • Extensive error detection and handling for reliable operations.
  • Fully Optimized for power, performance and memory.
  • Support for fault tolerant and recoverable application design.
  • Extensively documented both Java (online javadocs) and C code.
  • Scripts for quick builds, tests, installation etc.

Drivers and Services

  • Null modem emulator; tty2com is a feature rich null modem emulation driver supporting null modem, loopback, custom pinout and dynamic virtual serial port creation. Corresponding Desktop application, Eclipse IDE plugin, command line interface and Java/Python APIs are provided to manage virtual ports.

  • CP210x driver; kernel mode driver for usb-serial cp210x IC and products based on it with access to GPIO pins, IOCTL operations support, configuration and installations scripts, udev rules etc.

Getting started

The folder prebuilt-release in this repository contains ready-to-use jar file (sp-tty.jar) that can be imported in any project and referenced right away. Simply add sp-tty.jar in your project as an external library.

To add a jar in Eclipse, right-click on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the sp-core.jar and sp-tty.jar.

import com.serialpundit.serial.SerialComManager;
import com.serialpundit.serial.SerialComManager.BAUDRATE;
import com.serialpundit.serial.SerialComManager.DATABITS;
import com.serialpundit.serial.SerialComManager.FLOWCONTROL;
import com.serialpundit.serial.SerialComManager.PARITY;
import com.serialpundit.serial.SerialComManager.STOPBITS;

public class Example {
	public static void main(String[] args) {
		try {
			SerialComManager scm = new SerialComManager();
			long handle = scm.openComPort("/dev/ttyUSB1", true, true, false);
			scm.configureComPortData(handle, DATABITS.DB_8, STOPBITS.SB_1, PARITY.P_NONE, BAUDRATE.B115200, 0);
			scm.configureComPortControl(handle, FLOWCONTROL.NONE, 'x', 'x', false, false);
			scm.writeString(handle, "testing hello", 0) == true);
			String data = scm.readString(handle);
			System.out.println("data read is :" + data);
			scm.closeComPort(handle);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Resources

Help the project grow

  • Suggest features and enhancements
  • Report bugs and fixes
  • Help with missing documentation or improvements
  • Suggest more test cases and scenarios
  • Publish an article on your blog to educate others about this project
  • Provide peer support on mailing lists, forums or newsgroups

Author, License and Copyright

  • SerialPundit is designed, developed and maintained by Rishi Gupta. He does Linux driver development, embedded systems design, firmware development, circuit designing, prototyping, board bring up etc.
    Linkdin profile : http://in.linkedin.com/pub/rishi-gupta/20/9b8/a10

  • SerialPundit is DUAL LICENSED. It is made available under the terms of the GNU Affero General Public License (AGPL) v3.0 for non-commercial use and under the terms of a commercial license for commercial use of this library. Contact author for commercial license.

    See LICENSE file in repository for full license text for AGPL v3.0.

serialpundit's People

Contributors

rishigupta12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serialpundit's Issues

SerialComManager.setRTS() causes exception

Hi Rishi,

I'm running Test23 under Win7 64bit and it causes an exception when setRTS() is called (scm.setRTS(DTE, true); )

com.serialpundit.core.SerialComException: The data area passed to a system call is too small.

	at com.serialpundit.serial.internal.SerialComPortJNIBridge.setRTS(Native Method)
	at com.serialpundit.serial.SerialComManager.setRTS(SerialComManager.java:1505)
	at test23.Test23.main(Test23.java:65)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [util.c:840]

scm.configureComPortData error

I am getting an error when using the library on a Raspberry3, connecting to a serial port (/dev/ttyACM0).
The error is : Inappropriate ioctl for device when scm.configureComPortControl is called as below.
I tested the port with other libraries and it works so I am sure the serial port is set up correctly.

` private void setSerialComms(String portName, BAUDRATE baudRate, DATABITS dataBits, STOPBITS stopBits, PARITY parity,
FLOWCONTROL flowControl) {

	System.out.println("Creating serial port : " + portName);

	try {
		scm = new SerialComManager();
		serialPort = scm.openComPort(portName, true, true, false);
		scm.configureComPortData(serialPort, dataBits, stopBits, parity, baudRate, 0);
		scm.configureComPortControl(serialPort, flowControl, 'x', 'x', false, false);
		serialBuffer.clear();
	} catch (IOException e) {
		throw new RuntimeException("Could not open serial port: " + e.toString());
	}

}`

Latency timer

I am unable to use the getLatencyTimer and setLatencyTimer methods.
When I use getLatencyTimer I get:
com.serialpundit.core.SerialComException: CM_Get_DevNode_Registry_Property CR_xxxx error code : 0x25

When I use setLatencyTimer I get:
com.serialpundit.core.SerialComException: Given COM port does not exist or may not be a FTDI com port !

But if I use find method findComPortFromUSBAttributes I get the COM port name correctly "COM3".

Why am I unable to use these latency timer methods?

Java: 11
OS: Windows 10
Driver: FTDI VCP

sp-usb.jar contains wrong win32 DLL

The sp-usb.jar contains a wrong win32 DLL that is not picked up. The name is spusbwinx32.dll instead of spusbwinx86.dll.
Renaming this file solves the problem.

OS X 10.9.5 PortListener and DataListener

Hi,

I am on mac OS X 10.9.5 and running into issues with listeners when the USB port is disconnected.
I create and register the required listeners via, where app implements the ISerialComPortMonitor as following:

    scm = new SerialComManager();
    System.out.println(scm.getOSType());
    System.out.println(scm.getLibraryVersions());
    dataListener = new DataListener();
    eventListener = new EventListener();
    comPortHandle = scm.openComPort("/dev/cu.usbmodem1421", true, true, true);
    scm.configureComPortData(comPortHandle, DATABITS.DB_8, STOPBITS.SB_1, PARITY.P_NONE, BAUDRATE.B57600, 0);
    scm.configureComPortControl(comPortHandle, FLOWCONTROL.NONE, '$', '$', false, false);
    scm.registerPortMonitorListener(comPortHandle, app);    
    scm.registerDataListener(comPortHandle, dataListener);
    scm.registerLineEventListener(comPortHandle, eventListener);

I receive the disconnect/connects events properly, but right after the disconnect ISerialComDataListener starts to flood with errors at:
@OverRide
public void onDataListenerError(int arg0) {
System.out.println("onDataListenerError called");
}

I tried couple of things to unregister and reregister the listeners (event,data) which just guides to detachment of listeners and registration exceptions. Reconnection to the port fails, since the port is still open. Rerun and create new scm instance helps, but detaches the listeners on and I get "Listener not registered" errors on next USB detachment.

How can I avoid the onDataListenerError calls or am I missing something?

Expected behavior.

  1. USB connected
  2. Create SCM instance and register all listeners Port,Serial,Data
  3. Unplug USB -> Port event == 2 should result in stopping serial and data Listeners from interfering with a dead scm connection
    4.Reconnect USB -> Port event == 1 properly should reuse register serial and data listeners without errors.

Another remark: I can kill the JVM by simply trying to unregister the portListeners when onPortMonitorEvent == 2 is called. Which is a stupid circular parent destroy access I know, but it should be handled properly without killing the VM. Again all OSX.

Thanks,
Rtg

If i use scm.writeBytes other threads always freeze

If i use scm.writeBytes other threads always freeze

Example:

runProgressBar();
// WriteToPort
            Object[] openPort = openComPort(selectedComPort.getSelectedItem().toString());
            scm = (SerialComManager) openPort[0];
            handle = (long) openPort[1];
            try {
                // Write delayInbytes
                scm.writeBytes(handle, messagesData.getBytes(), speedSlider.getValue());
                //System.out.println("WRITE COMPLATE : ");
                //System.out.println("write : " + scm.writeString(handle, textSpeedSliderStringValue, 0));
                portRepeatingRead();
            } catch (Exception e) {
                e.printStackTrace();
            }

public void runProgressBar() {
    loadingBar.setVisible(true);
    loadingBar.setStringPainted(true);
    threadProgressBar = new Thread(new Runnable() {
        @Override
        public void run() {
            int i = 0; 
            try { 
            while (i <= 100) { 
                // fill the menu bar 
                loadingBar.setValue(i + 10); 
  
                // delay the thread 
                Thread.sleep(messagePercent1); 
                i += 1; 
            } 
        } 
        catch (Exception e) { 
        } 
        }
    });
    threadProgressBar.start();
}

//-------------------------------------------------------//
runProgressBar(); function start before scm. But always freeze. after finished write port loadingBar.setVisible(true); work. why?

Maven repository is not updated

Hi,

i have seen in the documentation that maven link is:

<dependency>
            <groupId>com.embeddedunveiled</groupId>
            <artifactId>scm</artifactId>
            <version>1.0.4</version>
        </dependency>

but this is not correct, the last version is 1.0.3

the other link with 1.0.4 is
org.bidib.com.embeddedunveiled

also the latest build in the prebuild folder is very new and v1.0.4 is back to Nov 2016

I hope Maven repo is updated with the latest always

Could not identify CPU architecture

Hi Rishi,

I am using your latest sp-core.jar and sp-tty.jar, but after I run my application it show error below,
Could you please give me some advice that I can identify the issue, thanks.

Exception in thread "main" com.serialpundit.core.SerialComException: Could not identify CPU architecture. Please report your environemnt to us so that we can add support for it !
at com.serialpundit.serial.SerialComManager.(SerialComManager.java:353)

Also here is part content in my raspberry pi 3's /proc/cpuinfo.

processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 76.80
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Timeout for RX and TX on ISerialIOStream

Hello,
I settled your lib which seem to works (I can transmit and receive in BLOCKING mode) I'm currently on Windows but project will need to work on Linux Desktop and Windows.

I wanted to add timeout for the receive parts, so it seem I need to use NONBLOCKING mode:

_outputStream = (SerialComOutByteStream) _serial.getIOStreamInstance(SerialComManager.OutputStream, _handle, SMODE.NONBLOCKING);
_inputStream = (SerialComInByteStream) _serial.getIOStreamInstance(SerialComManager.InputStream, _handle, SMODE.NONBLOCKING);

Now I'm stuck because I cannot find a place where I can set the Timeout for RX parts.
I saw the following function:

fineTuneReadBehaviour(long handle, int vmin, int vtime, int rit, int rttm, int rttc)

But I don't know how to use it. What are the parameters values. I need for example 3000ms of read timeout.
Also I need to differenciate a timeout exception from an error on the stream (ie: if read function on byteStream return -1 for error on stream, what is returned when it timeout? An exception?).

Any help or answer will be appreciated :-)

Regards.

Application Crash when starting multiple instance of java file.

Thanks for the great library,
I am facing problem in running two instance on a single machine with different com port, application is generating error
com.serialpundit.core.SerialComException: C:\Windows\TEMP\sp_tuartx1\spcomwinx64.dll
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:393)
at com.serialpundit.serial.SerialComManager.(SerialComManager.java:382)
at ecibautomatebs.ECIBFetchCNIC.Port(ECIBFetchCNIC.java:31)
at ecibautomatebs.ECIBFetchCNIC.FetchCNIC(ECIBFetchCNIC.java:98)
at ecibautomatebs.ECIBFetchCNIC.main(ECIBFetchCNIC.java:52)
Caused by: com.serialpundit.core.SerialComException: C:\Windows\TEMP\sp_tuartx1\spcomwinx64.dll
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:355)
... 4 more
Caused by: java.io.FileNotFoundException: C:\Windows\TEMP\sp_tuartx1\spcomwinx64.dll (The process cannot access the file because it is being used by another process)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:335)

Please suggest how can i get off of this error. My limitation is to use single machine as send and receiver with continuous running service.

Thanks

Can not get shared library spcomlnxarmv7hf.so resource as stream from sp-tty.jar file

Hi,
When I run my java application on Raspberry Pi, it show errors below, can you help me compile a new sp-tty.jar for raspberry pi, thanks.

Exception in thread "main" com.serialpundit.core.SerialComException: /tmp/sp_tuartx1/spcomlnxarmv7hf.so
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:322)
at com.serialpundit.serial.SerialComManager.(SerialComManager.java:367)
...................
Caused by: com.serialpundit.core.SerialComException: Can not get shared library spcomlnxarmv7hf.so resource as stream from sp-tty.jar file !
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:319)
... 3 more

Cannot make it work on Windows 10 x64

Hi
The library works without a hitch on Linux but I cannot make it work on Windows 10 AMD x64. Every time I try ranning it, the JVM crashes with EXCEPTION_ACCESS_VIOLATION (0xc0000005). I tried on 3 different machines with the same crash. I checked all the libraries (msvcr120.dll, setupapi.dll, advapi32.dll, kernel32.dll) and there they are. There is no consistency in crash log files (hs_err_pid...log). I attach some of these files. It seems like Windows 10 (x64) is not supported but how can I be sure.

hs_err_pid5820.txt
hs_err_pid8624.txt
hs_err_pid8996.txt

Drop "SerialComManager.BAUDRATE baudRate" parameter of SerialComManager.configureComPortData() function

The "SerialComManager.BAUDRATE baudRate" parameter duplicates the "int custBaud" parameter. Nothing prevents from invoking
SerialComManager.configureComPortData() with e.g. BAUDRATE.B115200.getValue() as "custBaud" value.

The first scenario of using configureComPortData() which comes into mind is:

DATABITS db = DATABITS.DB_8;
STOPBITS sb = STOPBITS.SB_1;
PARITY p = PARITY.P_NONE;
int userTypedBaudRate;

// Some code affecting db, sb, p and userTypedBaudRate here

...configureComPortData(handle, db, sb, p, BAUDRATE.BCUSTOM, userTypedBaudRate);

"Can't find dependent libraries" on Win 10 32 and 64 bit

Hello!

A freshly installed Windows 10 (tested with 32 AND 64 bit) causes the following exception:

com.serialpundit.core.SerialComException: C:\Users\thomas\AppData\Local\Temp\sp_tuartx1\spcomwinx64.dll: Can't find dependent libraries
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:395)
at com.serialpundit.serial.SerialComManager.(SerialComManager.java:382)
at serialTest.test.main(test.java:14)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\thomas\AppData\Local\Temp\sp_tuartx1\spcomwinx64.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.serialpundit.serial.internal.SerialComPortJNIBridge$2.run(SerialComPortJNIBridge.java:378)
at com.serialpundit.serial.internal.SerialComPortJNIBridge$2.run(SerialComPortJNIBridge.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:376)
... 2 more

The source:
package serialTest;

import java.io.IOException;

import com.serialpundit.serial.SerialComManager;

public class test {

public static void main(String[] args) {
	System.out.println(System.getProperty("os.name"));
	System.out.println(System.getProperty("os.version"));
	System.out.println(System.getProperty("java.class.path"));
	try {
		new SerialComManager();
	} catch (IOException e) {
		e.printStackTrace();
	}
}

}

The output:

Windows 10
10.0
C:\Program Files\Java\jre1.8.0_151\lib\resources.jar;C:\Program Files\Java\jre1.8.0_151\lib\rt.jar;C:\Program Files\Java\jre1.8.0_151\lib\jsse.jar;C:\Program Files\Java\jre1.8.0_151\lib\jce.jar;C:\Program Files\Java\jre1.8.0_151\lib\charsets.jar;C:\Program Files\Java\jre1.8.0_151\lib\jfr.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\cldrdata.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\dnsns.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\jaccess.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\jfxrt.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\localedata.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\nashorn.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\sunec.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\sunmscapi.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jre1.8.0_151\lib\ext\zipfs.jar;C:\Users\thomas\eclipse-workspace\SerialTest\bin;C:\Users\thomas\eclipse-workspace\SerialTest\libs\gettext-commons-0.9.jar;C:\Users\thomas\eclipse-workspace\SerialTest\libs\jssc.jar;C:\Users\thomas\eclipse-workspace\SerialTest\libs\xercesImpl.jar;C:\Users\thomas\eclipse-workspace\SerialTest\libs\sp-core.jar;C:\Users\thomas\eclipse-workspace\SerialTest\libs\sp-tty.jar
com.serialpundit.core.SerialComException: (....)

Any idea?
Best regards,
Thomas

Trouble loading ftdi d2xx lib under Windows7 x64

Hi,
When running test 62 similar logic, exception was thrown as below:

Caused by: com.serialpundit.core.SerialComException: Can not get shared library spd2xxwinx64.dll resource as stream from sp-tty.jar file !

Opened archive, seems like the spd2xxwinx64.dll file is missing.

I'm running with Java 1.8.0_111. Tried both sp-tty from maven and this repo, neither worked. Let me know if I did anything wrong. Thanks!

Linux kernel driver problem

When i try to remove all devices (by command from README), my kernel stuck, in logs i found:

Mar 18 22:55:59 [44248.147927] BUG: unable to handle kernel paging request at 000000ff0000ffa8
Mar 18 22:55:59 [44248.147942] IP: _raw_spin_lock_irqsave+0x1e/0x40
Mar 18 22:55:59 [44248.147946] PGD 0 P4D 0 
Mar 18 22:55:59 [44248.147952] Oops: 0002 [#1] SMP NOPTI
Mar 18 22:55:59 [44248.147956] Modules linked in: tty2com(O) binfmt_misc reiserfs dm_mod br_netfilter bridge stp llc fuse tty0tty(O) tun loop pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) it87 hwmon_vid joydev usblp cp210x usbserial hid_generic usbhid hid snd_hda_codec_hdmi btrfs zstd_decompress zstd_compress xxhash xor raid6_pq pktcdvd nvidia_drm(PO) nvidia_modeset(PO) evdev edac_mce_amd kvm_amd nvidia(PO) snd_hda_codec_realtek kvm irqbypass crct10dif_pclmul snd_hda_codec_generic crc32_pclmul crc32c_intel ohci_pci ghash_clmulni_intel pcbc snd_hda_intel drm_kms_helper aesni_intel efi_pstore aes_x86_64 snd_hda_codec crypto_simd glue_helper cryptd snd_hda_core drm snd_hwdep ipmi_devintf snd_pcm xhci_pci snd_timer ehci_pci pcspkr ohci_hcd ipmi_msghandler efivars xhci_hcd r8169 snd ehci_hcd fam15h_power k10temp
Mar 18 22:55:59 [44248.148034]  soundcore mii usbcore sp5100_tco usb_common i2c_piix4 shpchp button acpi_cpufreq efivarfs initio BusLogic arcmsr aic7xxx aic79xx scsi_transport_spi sr_mod cdrom sg sd_mod pdc_adma sata_mv ata_piix ahci libahci sata_qstor sata_vsc sata_uli sata_sis pata_sis sata_sx4 sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise libata scsi_mod ext4 fscrypto jbd2 mbcache crc16
Mar 18 22:55:59 [44248.148080] CPU: 2 PID: 3173 Comm: bash Tainted: P           O    4.14.12-2 #1
Mar 18 22:55:59 [44248.148083] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:55:59 [44248.148087] task: ffff94244ac2a080 task.stack: ffffac4f84c5c000
Mar 18 22:55:59 [44248.148092] RIP: 0010:_raw_spin_lock_irqsave+0x1e/0x40
Mar 18 22:55:59 [44248.148095] RSP: 0018:ffffac4f84c5fdf8 EFLAGS: 00010046
Mar 18 22:55:59 [44248.148099] RAX: 0000000000000000 RBX: 0000000000000206 RCX: 0000000000000000
Mar 18 22:55:59 [44248.148102] RDX: 0000000000000001 RSI: ffff94249d8a5848 RDI: 000000ff0000ffa8
Mar 18 22:55:59 [44248.148105] RBP: 000000ff0000ffa8 R08: 0000000000000000 R09: 000000000000003e
Mar 18 22:55:59 [44248.148108] R10: ffffac4f84c5fcd0 R11: 000000000000003f R12: 0000000000000002
Mar 18 22:55:59 [44248.148111] R13: ffff9423b855f700 R14: ffffffffc16356e0 R15: 000000000000003e
Mar 18 22:55:59 [44248.148115] FS:  00007fbfe889f740(0000) GS:ffff9424aec80000(0000) knlGS:0000000000000000
Mar 18 22:55:59 [44248.148119] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:55:59 [44248.148122] CR2: 000000ff0000ffa8 CR3: 000000010ce4c000 CR4: 00000000000406e0
Mar 18 22:55:59 [44248.148125] Call Trace:
Mar 18 22:55:59 [44248.148140]  tty_port_tty_get+0x19/0x40
Mar 18 22:55:59 [44248.148150]  0xffffffffc1633c91
Mar 18 22:55:59 [44248.148159]  proc_reg_write+0x3d/0x60
Mar 18 22:55:59 [44248.148166]  vfs_write+0xad/0x1a0
Mar 18 22:55:59 [44248.148173]  SyS_write+0x52/0xc0
Mar 18 22:55:59 [44248.148181]  system_call_fast_compare_end+0xc/0x6f
Mar 18 22:55:59 [44248.148185] RIP: 0033:0x7fbfe8177eb8
Mar 18 22:55:59 [44248.148190] RSP: 002b:00007ffd10039f90 EFLAGS: 00000246
Mar 18 22:55:59 [44248.148193] Code: ff 66 90 c3 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 53 9c 58 0f 1f 44 00 00 48 89 c3 fa 66 0f 1f 44 00 00 31 c0 ba 01 00 00 00 <f0> 0f b1 17 85 c0 75 05 48 89 d8 5b c3 89 c6 e8 be 03 9a ff 66 
Mar 18 22:55:59 [44248.148282] RIP: _raw_spin_lock_irqsave+0x1e/0x40 RSP: ffffac4f84c5fdf8
Mar 18 22:55:59 [44248.148286] CR2: 000000ff0000ffa8
Mar 18 22:55:59 [44248.148295] ---[ end trace 883a70a9d4231776 ]---
Mar 18 22:55:59 [44269.152493] INFO: rcu_sched detected stalls on CPUs/tasks:
Mar 18 22:55:59 [44269.152510] 	2-...: (0 ticks this GP) idle=77a/140000000000000/0 softirq=2551346/2551346 fqs=0 
Mar 18 22:55:59 [44269.152514] 	(detected by 0, t=5252 jiffies, g=1896230, c=1896229, q=4195)
Mar 18 22:55:59 [44269.152523] Sending NMI from CPU 0 to CPUs 2:
Mar 18 22:55:59 [44269.152535] NMI backtrace for cpu 2
Mar 18 22:55:59 [44269.152541] CPU: 2 PID: 3173 Comm: bash Tainted: P      D    O    4.14.12-2 #1
Mar 18 22:55:59 [44269.152542] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:55:59 [44269.152544] task: ffff94244ac2a080 task.stack: ffffac4f84c5c000
Mar 18 22:55:59 [44269.152549] RIP: 0010:0xfffffffefa758469
Mar 18 22:55:59 [44269.152550] RSP: 0018:ffffac4f84c5f280 EFLAGS: 00000046
Mar 18 22:55:59 [44269.152553] RAX: fffffffefec10000 RBX: fffffffeffc5b318 RCX: 0000000000ffc5cc
Mar 18 22:55:59 [44269.152555] RDX: fffffffefec10000 RSI: fffffffefa6de2b5 RDI: fffffffeffc5b300
Mar 18 22:55:59 [44269.152556] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000004
Mar 18 22:55:59 [44269.152558] R10: 0000000000000004 R11: ffffac4f84c5f2f0 R12: 0000000000000000
Mar 18 22:55:59 [44269.152559] R13: 0000000000000307 R14: 0000000000000007 R15: 0000000000000000
Mar 18 22:55:59 [44269.152562] FS:  00007fbfe889f740(0000) GS:ffff9424aec80000(0000) knlGS:0000000000000000
Mar 18 22:55:59 [44269.152563] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:55:59 [44269.152565] CR2: 000000ff0000ffa8 CR3: 000000022615e000 CR4: 00000000000406e0
Mar 18 22:55:59 [44269.152566] Call Trace:
Mar 18 22:55:59 [44269.152588]  ? efi_call+0x58/0x90
Mar 18 22:55:59 [44269.152595]  ? virt_efi_set_variable.part.7+0x5e/0x110
Mar 18 22:55:59 [44269.152599]  ? efi_query_variable_store+0x123/0x180
Mar 18 22:55:59 [44269.152603]  ? efivar_entry_set_safe+0x161/0x1d0
Mar 18 22:55:59 [44269.152606]  ? efivar_entry_set_safe+0x161/0x1d0
Mar 18 22:55:59 [44269.152612]  ? efi_pstore_write+0x10a/0x150 [efi_pstore]
Mar 18 22:55:59 [44269.152615]  ? efi_pstore_write+0x10a/0x150 [efi_pstore]
Mar 18 22:55:59 [44269.152622]  ? pstore_dump+0x169/0x330
Mar 18 22:55:59 [44269.152626]  ? vprintk_emit+0x337/0x3a0
Mar 18 22:55:59 [44269.152630]  ? kmsg_dump+0xb3/0xd0
Mar 18 22:55:59 [44269.152635]  ? oops_end+0x6e/0xc0
Mar 18 22:55:59 [44269.152638]  ? no_context+0x180/0x400
Mar 18 22:55:59 [44269.152642]  ? __do_page_fault+0x37b/0x4e0
Mar 18 22:55:59 [44269.152648]  ? page_fault+0x2c/0x60
Mar 18 22:55:59 [44269.152652]  ? _raw_spin_lock_irqsave+0x1e/0x40
Mar 18 22:55:59 [44269.152656]  ? tty_port_tty_get+0x19/0x40
Mar 18 22:55:59 [44269.152659]  ? 0xffffffffc1633c91
Mar 18 22:55:59 [44269.152664]  ? proc_reg_write+0x3d/0x60
Mar 18 22:55:59 [44269.152668]  ? vfs_write+0xad/0x1a0
Mar 18 22:55:59 [44269.152671]  ? SyS_write+0x52/0xc0
Mar 18 22:55:59 [44269.152674]  ? system_call_fast_compare_end+0xc/0x6f
Mar 18 22:55:59 [44269.152676] Code: 73 1a 48 8b d6 4d 8b c1 8a 0a 48 8b 05 39 2e 00 00 48 03 d5 4c 2b c5 88 48 0c 75 ec e8 fd fa ff ff 48 8b 15 22 2e 00 00 8a 4a 02 <48> 8b 05 18 2e 00 00 41 0f b7 d4 0b cd 88 48 02 48 8b 05 08 2e 
Mar 18 22:55:59 [44269.153525] rcu_sched kthread starved for 5252 jiffies! g1896230 c1896229 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x402 ->cpu=2
Mar 18 22:55:59 [44269.153569] rcu_sched       I    0     8      2 0x80000000
Mar 18 22:55:59 [44269.153575] Call Trace:
Mar 18 22:55:59 [44269.153588]  ? __schedule+0x28e/0x880
Mar 18 22:55:59 [44269.153594]  schedule+0x28/0x80
Mar 18 22:55:59 [44269.153600]  schedule_timeout+0x184/0x360
Mar 18 22:55:59 [44269.153607]  ? call_timer_fn+0x120/0x120
Mar 18 22:55:59 [44269.153612]  ? rcu_gp_kthread+0x4f0/0x8d0
Mar 18 22:55:59 [44269.153618]  ? prepare_to_swait_event+0x22/0x40
Mar 18 22:55:59 [44269.153621]  rcu_gp_kthread+0x4f0/0x8d0
Mar 18 22:55:59 [44269.153626]  ? rcu_note_context_switch+0x120/0x120
Mar 18 22:55:59 [44269.153630]  kthread+0x118/0x130
Mar 18 22:55:59 [44269.153635]  ? kthread_create_on_node+0x70/0x70
Mar 18 22:55:59 [44269.153640]  ret_from_fork+0x1f/0x30
Mar 18 22:56:26 [44295.444135] watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [panel-11-cpufre:6140]
Mar 18 22:56:26 [44295.444142] Modules linked in: tty2com(O) binfmt_misc reiserfs dm_mod br_netfilter bridge stp llc fuse tty0tty(O) tun loop pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) it87 hwmon_vid joydev usblp cp210x usbserial hid_generic usbhid hid snd_hda_codec_hdmi btrfs zstd_decompress zstd_compress xxhash xor raid6_pq pktcdvd nvidia_drm(PO) nvidia_modeset(PO) evdev edac_mce_amd kvm_amd nvidia(PO) snd_hda_codec_realtek kvm irqbypass crct10dif_pclmul snd_hda_codec_generic crc32_pclmul crc32c_intel ohci_pci ghash_clmulni_intel pcbc snd_hda_intel drm_kms_helper aesni_intel efi_pstore aes_x86_64 snd_hda_codec crypto_simd glue_helper cryptd snd_hda_core drm snd_hwdep ipmi_devintf snd_pcm xhci_pci snd_timer ehci_pci pcspkr ohci_hcd ipmi_msghandler efivars xhci_hcd r8169 snd ehci_hcd fam15h_power k10temp
Mar 18 22:56:26 [44295.444229]  soundcore mii usbcore sp5100_tco usb_common i2c_piix4 shpchp button acpi_cpufreq efivarfs initio BusLogic arcmsr aic7xxx aic79xx scsi_transport_spi sr_mod cdrom sg sd_mod pdc_adma sata_mv ata_piix ahci libahci sata_qstor sata_vsc sata_uli sata_sis pata_sis sata_sx4 sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise libata scsi_mod ext4 fscrypto jbd2 mbcache crc16
Mar 18 22:56:26 [44295.444276] CPU: 0 PID: 6140 Comm: panel-11-cpufre Tainted: P      D    O    4.14.12-2 #1
Mar 18 22:56:26 [44295.444279] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:56:26 [44295.444283] task: ffff9424a427d080 task.stack: ffffac4f81d54000
Mar 18 22:56:26 [44295.444293] RIP: 0010:smp_call_function_single+0xda/0x100
Mar 18 22:56:26 [44295.444297] RSP: 0018:ffffac4f81d57d80 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff10
Mar 18 22:56:26 [44295.444301] RAX: 0000000000000000 RBX: ffff94249d393000 RCX: 0000000000000000
Mar 18 22:56:26 [44295.444304] RDX: 0000000000000001 RSI: 00000000000000fb RDI: 0000000000000282
Mar 18 22:56:26 [44295.444307] RBP: ffffac4f81d57dd0 R08: ffff94249d393160 R09: ffff9424544cad80
Mar 18 22:56:26 [44295.444310] R10: ffffac4f81d57e00 R11: ffff9424a427d080 R12: 0000000000000002
Mar 18 22:56:26 [44295.444313] R13: ffff9423c0e88000 R14: 0000000000000001 R15: ffff94245442b880
Mar 18 22:56:26 [44295.444317] FS:  00007f35d8723000(0000) GS:ffff9424aec00000(0000) knlGS:0000000000000000
Mar 18 22:56:26 [44295.444321] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:56:26 [44295.444324] CR2: 00000000018cf078 CR3: 0000000206634000 CR4: 00000000000406f0
Mar 18 22:56:26 [44295.444327] Call Trace:
Mar 18 22:56:26 [44295.444336]  ? x86_match_cpu+0xa0/0xa0
Mar 18 22:56:26 [44295.444342]  ? arch_freq_get_on_cpu+0x38/0x80
Mar 18 22:56:26 [44295.444346]  arch_freq_get_on_cpu+0x38/0x80
Mar 18 22:56:26 [44295.444354]  show_scaling_cur_freq+0x18/0x80
Mar 18 22:56:26 [44295.444359]  show+0x2d/0x50
Mar 18 22:56:26 [44295.444366]  sysfs_kf_seq_show+0xb0/0x110
Mar 18 22:56:26 [44295.444372]  seq_read+0xd2/0x440
Mar 18 22:56:26 [44295.444378]  vfs_read+0x89/0x130
Mar 18 22:56:26 [44295.444383]  SyS_read+0x52/0xc0
Mar 18 22:56:26 [44295.444389]  system_call_fast_compare_end+0xc/0x6f
Mar 18 22:56:26 [44295.444393] RIP: 0033:0x7f35d64da69a
Mar 18 22:56:26 [44295.444396] RSP: 002b:00007fffc37cb040 EFLAGS: 00000246
Mar 18 22:56:26 [44295.444399] Code: 3c 25 28 00 00 00 75 40 48 83 c4 48 41 5a 5d 49 8d 62 f8 c3 48 89 d1 48 89 f2 48 8d 75 b0 e8 7e fe ff ff 8b 55 c8 83 e2 01 74 0a <f3> 90 8b 55 c8 83 e2 01 75 f6 eb c2 8b 05 4c 90 4f 01 85 c0 75 
Mar 18 22:56:53 [44318.339427] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2
Mar 18 22:56:53 [44318.339430] Modules linked in: tty2com(O) binfmt_misc reiserfs dm_mod br_netfilter bridge stp llc fuse tty0tty(O) tun loop pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) it87 hwmon_vid joydev usblp cp210x usbserial hid_generic usbhid hid snd_hda_codec_hdmi btrfs zstd_decompress zstd_compress xxhash xor raid6_pq pktcdvd nvidia_drm(PO) nvidia_modeset(PO) evdev edac_mce_amd kvm_amd nvidia(PO) snd_hda_codec_realtek kvm irqbypass crct10dif_pclmul snd_hda_codec_generic crc32_pclmul crc32c_intel ohci_pci ghash_clmulni_intel pcbc snd_hda_intel drm_kms_helper aesni_intel efi_pstore aes_x86_64 snd_hda_codec crypto_simd glue_helper cryptd snd_hda_core drm snd_hwdep ipmi_devintf snd_pcm xhci_pci snd_timer ehci_pci pcspkr ohci_hcd ipmi_msghandler efivars xhci_hcd r8169 snd ehci_hcd fam15h_power k10temp
Mar 18 22:56:53 [44318.339492]  soundcore mii usbcore sp5100_tco usb_common i2c_piix4 shpchp button acpi_cpufreq efivarfs initio BusLogic arcmsr aic7xxx aic79xx scsi_transport_spi sr_mod cdrom sg sd_mod pdc_adma sata_mv ata_piix ahci libahci sata_qstor sata_vsc sata_uli sata_sis pata_sis sata_sx4 sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise libata scsi_mod ext4 fscrypto jbd2 mbcache crc16
Mar 18 22:56:53 [44318.339528] CPU: 2 PID: 3173 Comm: bash Tainted: P      D    O L  4.14.12-2 #1
Mar 18 22:56:53 [44318.339530] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:56:53 [44318.339532] task: ffff94244ac2a080 task.stack: ffffac4f84c5c000
Mar 18 22:56:53 [44318.339536] RIP: 0010:0xfffffffefa757f7f
Mar 18 22:56:53 [44318.339537] RSP: 0018:ffffac4f84c5f218 EFLAGS: 00000002
Mar 18 22:56:53 [44318.339539] RAX: fffffffefec10000 RBX: fffffffeffc5e900 RCX: 0000000000ffc550
Mar 18 22:56:53 [44318.339541] RDX: fffffffefec10000 RSI: ffffac4f84c5f3e6 RDI: fffffffeffc5e900
Mar 18 22:56:53 [44318.339542] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000002
Mar 18 22:56:53 [44318.339544] R10: 0000000000000004 R11: ffffac4f84c5f2f0 R12: 0000000000000000
Mar 18 22:56:53 [44318.339545] R13: 0000000000000403 R14: ffffac4f84c5f580 R15: 0000000000000000
Mar 18 22:56:53 [44318.339548] FS:  00007fbfe889f740(0000) GS:ffff9424aec80000(0000) knlGS:0000000000000000
Mar 18 22:56:53 [44318.339549] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:56:53 [44318.339551] CR2: 000000ff0000ffa8 CR3: 000000022615e000 CR4: 00000000000406e0
Mar 18 22:56:53 [44318.339552] Call Trace:
Mar 18 22:56:53 [44318.339574]  ? efi_call+0x58/0x90
Mar 18 22:56:53 [44318.339581]  ? virt_efi_set_variable.part.7+0x5e/0x110
Mar 18 22:56:53 [44318.339585]  ? efi_query_variable_store+0x123/0x180
Mar 18 22:56:53 [44318.339589]  ? efivar_entry_set_safe+0x161/0x1d0
Mar 18 22:56:53 [44318.339591]  ? efivar_entry_set_safe+0x161/0x1d0
Mar 18 22:56:53 [44318.339597]  ? efi_pstore_write+0x10a/0x150 [efi_pstore]
Mar 18 22:56:53 [44318.339600]  ? efi_pstore_write+0x10a/0x150 [efi_pstore]
Mar 18 22:56:53 [44318.339606]  ? pstore_dump+0x169/0x330
Mar 18 22:56:53 [44318.339610]  ? vprintk_emit+0x337/0x3a0
Mar 18 22:56:53 [44318.339614]  ? kmsg_dump+0xb3/0xd0
Mar 18 22:56:53 [44318.339618]  ? oops_end+0x6e/0xc0
Mar 18 22:56:53 [44318.339622]  ? no_context+0x180/0x400
Mar 18 22:56:53 [44318.339626]  ? __do_page_fault+0x37b/0x4e0
Mar 18 22:56:53 [44318.339631]  ? page_fault+0x2c/0x60
Mar 18 22:56:53 [44318.339635]  ? _raw_spin_lock_irqsave+0x1e/0x40
Mar 18 22:56:53 [44318.339640]  ? tty_port_tty_get+0x19/0x40
Mar 18 22:56:53 [44318.339642]  ? 0xffffffffc1633c91
Mar 18 22:56:53 [44318.339647]  ? proc_reg_write+0x3d/0x60
Mar 18 22:56:53 [44318.339651]  ? vfs_write+0xad/0x1a0
Mar 18 22:56:53 [44318.339654]  ? SyS_write+0x52/0xc0
Mar 18 22:56:53 [44318.339657]  ? system_call_fast_compare_end+0xc/0x6f
Mar 18 22:56:53 [44318.339659] Code: 83 c4 20 5f c3 cc cc cc 66 90 48 8b 05 23 33 00 00 8a 48 02 48 8b 05 19 33 00 00 83 c9 10 88 48 02 48 8b 05 0c 33 00 00 8a 48 0d <f6> c1 07 75 da f3 c3 cc cc 8a 0d e0 32 00 00 48 8b 05 f3 32 00 
Mar 18 22:56:54 [44323.443749] watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [panel-11-cpufre:6140]
Mar 18 22:56:54 [44323.443756] Modules linked in: tty2com(O) binfmt_misc reiserfs dm_mod br_netfilter bridge stp llc fuse tty0tty(O) tun loop pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) it87 hwmon_vid joydev usblp cp210x usbserial hid_generic usbhid hid snd_hda_codec_hdmi btrfs zstd_decompress zstd_compress xxhash xor raid6_pq pktcdvd nvidia_drm(PO) nvidia_modeset(PO) evdev edac_mce_amd kvm_amd nvidia(PO) snd_hda_codec_realtek kvm irqbypass crct10dif_pclmul snd_hda_codec_generic crc32_pclmul crc32c_intel ohci_pci ghash_clmulni_intel pcbc snd_hda_intel drm_kms_helper aesni_intel efi_pstore aes_x86_64 snd_hda_codec crypto_simd glue_helper cryptd snd_hda_core drm snd_hwdep ipmi_devintf snd_pcm xhci_pci snd_timer ehci_pci pcspkr ohci_hcd ipmi_msghandler efivars xhci_hcd r8169 snd ehci_hcd fam15h_power k10temp
Mar 18 22:56:54 [44323.443842]  soundcore mii usbcore sp5100_tco usb_common i2c_piix4 shpchp button acpi_cpufreq efivarfs initio BusLogic arcmsr aic7xxx aic79xx scsi_transport_spi sr_mod cdrom sg sd_mod pdc_adma sata_mv ata_piix ahci libahci sata_qstor sata_vsc sata_uli sata_sis pata_sis sata_sx4 sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise libata scsi_mod ext4 fscrypto jbd2 mbcache crc16
Mar 18 22:56:54 [44323.443888] CPU: 0 PID: 6140 Comm: panel-11-cpufre Tainted: P      D    O L  4.14.12-2 #1
Mar 18 22:56:54 [44323.443891] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:56:54 [44323.443896] task: ffff9424a427d080 task.stack: ffffac4f81d54000
Mar 18 22:56:54 [44323.443906] RIP: 0010:smp_call_function_single+0xdc/0x100
Mar 18 22:56:54 [44323.443910] RSP: 0018:ffffac4f81d57d80 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff10
Mar 18 22:56:54 [44323.443914] RAX: 0000000000000000 RBX: ffff94249d393000 RCX: 0000000000000000
Mar 18 22:56:54 [44323.443917] RDX: 0000000000000001 RSI: 00000000000000fb RDI: 0000000000000282
Mar 18 22:56:54 [44323.443920] RBP: ffffac4f81d57dd0 R08: ffff94249d393160 R09: ffff9424544cad80
Mar 18 22:56:54 [44323.443923] R10: ffffac4f81d57e00 R11: ffff9424a427d080 R12: 0000000000000002
Mar 18 22:56:54 [44323.443926] R13: ffff9423c0e88000 R14: 0000000000000001 R15: ffff94245442b880
Mar 18 22:56:54 [44323.443930] FS:  00007f35d8723000(0000) GS:ffff9424aec00000(0000) knlGS:0000000000000000
Mar 18 22:56:54 [44323.443934] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:56:54 [44323.443937] CR2: 00000000018cf078 CR3: 0000000206634000 CR4: 00000000000406f0
Mar 18 22:56:54 [44323.443940] Call Trace:
Mar 18 22:56:54 [44323.443950]  ? x86_match_cpu+0xa0/0xa0
Mar 18 22:56:54 [44323.443955]  ? arch_freq_get_on_cpu+0x38/0x80
Mar 18 22:56:54 [44323.443959]  arch_freq_get_on_cpu+0x38/0x80
Mar 18 22:56:54 [44323.443967]  show_scaling_cur_freq+0x18/0x80
Mar 18 22:56:54 [44323.443972]  show+0x2d/0x50
Mar 18 22:56:54 [44323.443979]  sysfs_kf_seq_show+0xb0/0x110
Mar 18 22:56:54 [44323.443985]  seq_read+0xd2/0x440
Mar 18 22:56:54 [44323.443991]  vfs_read+0x89/0x130
Mar 18 22:56:54 [44323.443996]  SyS_read+0x52/0xc0
Mar 18 22:56:54 [44323.444002]  system_call_fast_compare_end+0xc/0x6f
Mar 18 22:56:54 [44323.444006] RIP: 0033:0x7f35d64da69a
Mar 18 22:56:54 [44323.444009] RSP: 002b:00007fffc37cb040 EFLAGS: 00000246
Mar 18 22:56:54 [44323.444012] Code: 28 00 00 00 75 40 48 83 c4 48 41 5a 5d 49 8d 62 f8 c3 48 89 d1 48 89 f2 48 8d 75 b0 e8 7e fe ff ff 8b 55 c8 83 e2 01 74 0a f3 90 <8b> 55 c8 83 e2 01 75 f6 eb c2 8b 05 4c 90 4f 01 85 c0 75 81 0f 
Mar 18 22:57:02 [44332.171626] INFO: rcu_sched detected stalls on CPUs/tasks:
Mar 18 22:57:02 [44332.171644] 	2-...: (0 ticks this GP) idle=77a/140000000000000/0 softirq=2551346/2551346 fqs=7754 
Mar 18 22:57:02 [44332.171647] 	(detected by 3, t=21007 jiffies, g=1896230, c=1896229, q=14528)
Mar 18 22:57:02 [44332.171655] Sending NMI from CPU 3 to CPUs 2:
Mar 18 22:57:02 [44332.171667] NMI backtrace for cpu 2
Mar 18 22:57:02 [44332.171672] CPU: 2 PID: 3173 Comm: bash Tainted: P      D    O L  4.14.12-2 #1
Mar 18 22:57:02 [44332.171674] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:57:02 [44332.171676] task: ffff94244ac2a080 task.stack: ffffac4f84c5c000
Mar 18 22:57:02 [44332.171680] RIP: 0010:0xfffffffefa757f7f
Mar 18 22:57:02 [44332.171682] RSP: 0018:ffffac4f84c5f278 EFLAGS: 00000002
Mar 18 22:57:02 [44332.171685] RAX: fffffffefec10000 RBX: fffffffeffc6873c RCX: 0000000000ffc650
Mar 18 22:57:02 [44332.171687] RDX: fffffffefa6de2b3 RSI: fffffffefa6de2af RDI: fffffffeffc68700
Mar 18 22:57:02 [44332.171689] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000004
Mar 18 22:57:02 [44332.171690] R10: 0000000000000004 R11: ffffac4f84c5f2f0 R12: 0000000000000000
Mar 18 22:57:02 [44332.171692] R13: 000000000000040a R14: 0000000000000007 R15: 0000000000000000
Mar 18 22:57:02 [44332.171695] FS:  00007fbfe889f740(0000) GS:ffff9424aec80000(0000) knlGS:0000000000000000
Mar 18 22:57:02 [44332.171697] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:57:02 [44332.171699] CR2: 000000ff0000ffa8 CR3: 000000022615e000 CR4: 00000000000406e0
Mar 18 22:57:02 [44332.171701] Call Trace:
Mar 18 22:57:02 [44332.171724]  ? efi_call+0x58/0x90
Mar 18 22:57:02 [44332.171731]  ? virt_efi_set_variable.part.7+0x5e/0x110
Mar 18 22:57:02 [44332.171736]  ? efi_query_variable_store+0x123/0x180
Mar 18 22:57:02 [44332.171740]  ? efivar_entry_set_safe+0x161/0x1d0
Mar 18 22:57:02 [44332.171743]  ? efivar_entry_set_safe+0x161/0x1d0
Mar 18 22:57:02 [44332.171750]  ? efi_pstore_write+0x10a/0x150 [efi_pstore]
Mar 18 22:57:02 [44332.171754]  ? efi_pstore_write+0x10a/0x150 [efi_pstore]
Mar 18 22:57:02 [44332.171761]  ? pstore_dump+0x169/0x330
Mar 18 22:57:02 [44332.171765]  ? vprintk_emit+0x337/0x3a0
Mar 18 22:57:02 [44332.171770]  ? kmsg_dump+0xb3/0xd0
Mar 18 22:57:02 [44332.171775]  ? oops_end+0x6e/0xc0
Mar 18 22:57:02 [44332.171779]  ? no_context+0x180/0x400
Mar 18 22:57:02 [44332.171783]  ? __do_page_fault+0x37b/0x4e0
Mar 18 22:57:02 [44332.171790]  ? page_fault+0x2c/0x60
Mar 18 22:57:02 [44332.171794]  ? _raw_spin_lock_irqsave+0x1e/0x40
Mar 18 22:57:02 [44332.171799]  ? tty_port_tty_get+0x19/0x40
Mar 18 22:57:02 [44332.171802]  ? 0xffffffffc1633c91
Mar 18 22:57:02 [44332.171808]  ? proc_reg_write+0x3d/0x60
Mar 18 22:57:02 [44332.171812]  ? vfs_write+0xad/0x1a0
Mar 18 22:57:02 [44332.171815]  ? SyS_write+0x52/0xc0
Mar 18 22:57:02 [44332.171818]  ? system_call_fast_compare_end+0xc/0x6f
Mar 18 22:57:02 [44332.171820] Code: 83 c4 20 5f c3 cc cc cc 66 90 48 8b 05 23 33 00 00 8a 48 02 48 8b 05 19 33 00 00 83 c9 10 88 48 02 48 8b 05 0c 33 00 00 8a 48 0d <f6> c1 07 75 da f3 c3 cc cc 8a 0d e0 32 00 00 48 8b 05 f3 32 00 
Mar 18 22:57:04 [44333.375138] perf: interrupt took too long (3903 > 2500), lowering kernel.perf_event_max_sample_rate to 51250
Mar 18 22:57:04 [44333.376093] BUG: unable to handle kernel paging request at fffffffeffc6e0f6
Mar 18 22:57:04 [44333.376106] IP: 0xfffffffefa753ef1
Mar 18 22:57:04 [44333.376110] PGD 57c0e067 P4D 57c0e067 PUD 0 
Mar 18 22:57:04 [44333.376118] Oops: 0000 [#2] SMP NOPTI
Mar 18 22:57:04 [44333.376122] Modules linked in: tty2com(O) binfmt_misc reiserfs dm_mod br_netfilter bridge stp llc fuse tty0tty(O) tun loop pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) it87 hwmon_vid joydev usblp cp210x usbserial hid_generic usbhid hid snd_hda_codec_hdmi btrfs zstd_decompress zstd_compress xxhash xor raid6_pq pktcdvd nvidia_drm(PO) nvidia_modeset(PO) evdev edac_mce_amd kvm_amd nvidia(PO) snd_hda_codec_realtek kvm irqbypass crct10dif_pclmul snd_hda_codec_generic crc32_pclmul crc32c_intel ohci_pci ghash_clmulni_intel pcbc snd_hda_intel drm_kms_helper aesni_intel efi_pstore aes_x86_64 snd_hda_codec crypto_simd glue_helper cryptd snd_hda_core drm snd_hwdep ipmi_devintf snd_pcm xhci_pci snd_timer ehci_pci pcspkr ohci_hcd ipmi_msghandler efivars xhci_hcd r8169 snd ehci_hcd fam15h_power k10temp
Mar 18 22:57:04 [44333.376208]  soundcore mii usbcore sp5100_tco usb_common i2c_piix4 shpchp button acpi_cpufreq efivarfs initio BusLogic arcmsr aic7xxx aic79xx scsi_transport_spi sr_mod cdrom sg sd_mod pdc_adma sata_mv ata_piix ahci libahci sata_qstor sata_vsc sata_uli sata_sis pata_sis sata_sx4 sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise libata scsi_mod ext4 fscrypto jbd2 mbcache crc16
Mar 18 22:57:04 [44333.376260] CPU: 2 PID: 8045 Comm: kworker/2:2 Tainted: P      D    O L  4.14.12-2 #1
Mar 18 22:57:04 [44333.376263] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./970A-DS3P, BIOS FB 10/31/2014
Mar 18 22:57:04 [44333.376271] Workqueue: events efivar_update_sysfs_entries [efivars]
Mar 18 22:57:04 [44333.376275] task: ffff9424546df0c0 task.stack: ffffac4f8a294000
Mar 18 22:57:04 [44333.376279] RIP: 0010:0xfffffffefa753ef1
Mar 18 22:57:04 [44333.376281] RSP: 0018:ffffac4f8a297b20 EFLAGS: 00010213
Mar 18 22:57:04 [44333.376285] RAX: 00000000ffffffff RBX: ffffac4f8a297ba0 RCX: fffffffeffc6e0f2
Mar 18 22:57:04 [44333.376288] RDX: ffffac4f8a297ba0 RSI: ffffac4f8a297df8 RDI: 0000000000000000
Mar 18 22:57:04 [44333.376291] RBP: 0000000000000040 R08: fffffffeffc6e0f2 R09: 0000000000000000
Mar 18 22:57:04 [44333.376294] R10: ffffac4f8a297ba0 R11: fffffffeffc50000 R12: ffffac4f8a297df8
Mar 18 22:57:04 [44333.376297] R13: 8000000000000015 R14: 0000000000000286 R15: ffffffffb24ec7c8
Mar 18 22:57:04 [44333.376301] FS:  0000000000000000(0000) GS:ffff9424aec80000(0000) knlGS:0000000000000000
Mar 18 22:57:04 [44333.376304] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 18 22:57:04 [44333.376306] CR2: fffffffefa753ef1 CR3: 0000000057c0a000 CR4: 00000000000406e0
Mar 18 22:57:04 [44333.376309] Call Trace:
Mar 18 22:57:04 [44333.376323]  ? efi_call+0x58/0x90
Mar 18 22:57:04 [44333.376332]  ? virt_efi_get_next_variable+0x6e/0x120
Mar 18 22:57:04 [44333.376336]  ? efivar_init+0x11c/0x3a0
Mar 18 22:57:04 [44333.376342]  ? sched_clock+0x5/0x10
Mar 18 22:57:04 [44333.376347]  ? efivar_release+0x20/0x20 [efivars]
Mar 18 22:57:04 [44333.376351]  ? put_prev_entity+0x1e/0xe0
Mar 18 22:57:04 [44333.376357]  ? efivar_update_sysfs_entries+0x24/0x60 [efivars]
Mar 18 22:57:04 [44333.376361]  ? efivar_update_sysfs_entries+0x24/0x60 [efivars]
Mar 18 22:57:04 [44333.376366]  ? process_one_work+0x185/0x380
Mar 18 22:57:04 [44333.376371]  ? worker_thread+0x2e/0x390
Mar 18 22:57:04 [44333.376375]  ? process_one_work+0x380/0x380
Mar 18 22:57:04 [44333.376379]  ? kthread+0x118/0x130
Mar 18 22:57:04 [44333.376382]  ? kthread_create_on_node+0x70/0x70
Mar 18 22:57:04 [44333.376387]  ? exit_to_usermode_loop+0x6e/0xc0
Mar 18 22:57:04 [44333.376392]  ? ret_from_fork+0x1f/0x30
Mar 18 22:57:04 [44333.376396] Code:  Bad RIP value.
Mar 18 22:57:04 [44333.376408] RIP: 0xfffffffefa753ef1 RSP: ffffac4f8a297b20
Mar 18 22:57:04 [44333.376411] CR2: fffffffeffc6e0f6
Mar 18 22:57:04 [44333.376415] ---[ end trace 883a70a9d4231777 ]---

Kernel used:

uname -rsvo
Linux 4.14.12-2 #1 SMP Sun Jan 7 15:31:02 CET 2018 GNU/Linux

javax.comm Implementation

Hi, I'm trying to wrap SerialPundit into Javax.comm API, cause javax.comm works only on linx86 or solaris

I need it to be able to connect to serial devices running on any OS and x86 or x64 Java, because a lot of legacy code used javax.comm API.

Currently i cannot test it, but i have a question, in legacy code i have something like:

serialPort.addEventListener(myListener);
serialPort.notifyOnDataAvailable(true);

and in MyListener ->

public void serialEvent(SerialPortEvent arg0) {
	if(arg0.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
		while(serialPort.getInputStream().available() > 0 ) {
		    byte b = (byte)serialPort.getInputStream().read();
                //SomeCode
                }
               //SomeCode
       }
}

In my implementation of javax.comm.SerialPort i have:

public void addEventListener(SerialPortEventListener spel)  {
		
		//TODO Handle EVENTS SerialPortEventListener wrap to ISerialComDataListener or ISerialComEventListener
			scm.registerDataListener(handle, new ISerialComDataListener() {
				@Override
				public void onNewSerialDataAvailable(byte[] data) {
					// TODO Auto-generated method stub
				}
				
				@Override
				public void onDataListenerError(int errorNum) {
					// TODO Auto-generated method stub
				}
			});
	} 

And now i see some problem. Cause in javax.comm API code i'm recieving event that data is available and then reading bytes from input stream.

But in your code i see onNewSerialDataAvailable(byte[] data), so that means that data is already readed, it's in data variable, so serialPort.getInputStream().read() will not work? Or Im wrong?

ISerialComEventListener and CTS change

Hello Rishi,

The ISerialComEventListener is only called once if linestatus CTS changes from 1 to 0 but not if line status changes from 0 to 1.
I'm testing on Windows 10 64-bit and I use FLOWCONTROL.RTS_CTS.

Get InputStream from SerialComManager

I'm about to make use of marine api.

To start off, an InputStream is needed, but I don't know whether the first line is correct or not:

InputStream is = (InputStream) scm.getIOStreamInstance(SerialComManager.InputStream, handleGps, SMODE.NONBLOCKING);
SentenceReader sr = new SentenceReader(is);
sr.addSentenceListener(this);
sr.start();

If not, is there any other way?

Thanks!

Add support for armv7 to sp-usb.jar

Hi Rishi,

Could you add support for ARMv7 to sp-usb.jar? Running on a Bananapi it complains about missing spusblnxarmv7hf.so .

Regards,
Andreas

A better readme.md?

Nice work! perhaps a few trivial fixes for people to better understand what your library can do?

  • Github parses README.md as markdown so take advantage of it.
  • Include example usage (its now in PDF which github can't show) in the README.md or INSTALL.md?

2018-03-25 20:40:59 JNI call ThrowNew failed to throw exception !, FormatMessageA(), error code : 15100

Hi;

I'm try only this:
`class HotPlugEventWatcher implements ISerialComUSBHotPlugListener {

@Override
public void onUSBHotPlugEvent(int event, int usbvid, int usbpid, String serialNumber) {

    if(event == SerialComUSB.DEV_ADDED) {
        System.out.println("DUT added, running automated tests for this device !");

    }else if(event == SerialComUSB.DEV_REMOVED) {
        System.out.println("DUT removed, running tests, if any, to be run after device removal !");
        System.out.println("usbvid : " + usbvid);
    }else {
    }
    
}

}`

If I'm unplug my usb Device from USB port netbeans show this message:

2018-03-25 20:40:59 JNI call ThrowNew failed to throw exception !, FormatMessageA(), error code : 15100

Native Library /tmp/sp_tuartx1/spcomlnxx64.so already loaded in another classloader with servlet

Regards, how are you? I have a web application with java using vaadin framework, when I make a change in my code and restart my servlet I get this log, Everything returns to work correctly when, to completely my jetty or wildfly server, and I start again

com.serialpundit.core.SerialComException: Native Library /tmp/sp_tuartx1/spcomlnxx64.so already loaded in another classloader at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:395) at com.serialpundit.serial.SerialComManager.<init>(SerialComManager.java:382)

My app not work some windows 10

Hi;
My app works one more windows 10. But I see not work one PC why?:

C:>java -jar EWC.jar
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\Users\muhar\AppData\Local\Temp\sp_tuartx1\spusbwinx86.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.serialpundit.usb.internal.SerialComUSBJNIBridge$2.run(SerialComUSBJNIBridge.java:340)
at com.serialpundit.usb.internal.SerialComUSBJNIBridge$2.run(SerialComUSBJNIBridge.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at com.serialpundit.usb.internal.SerialComUSBJNIBridge.loadNativeLibrary(SerialComUSBJNIBridge.java:338)
at com.serialpundit.usb.SerialComUSB.(SerialComUSB.java:136)
at ewc.Main.(Main.java:239)
at ewc.EWC$1.run(EWC.java:42)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

serial library seems to be missing from maven

Hi, I tried to import core and serial using gradle from the Maven repository.
I could only find the core module, not serial, in the repo.
Is this by design? Or can you add it?
Thank you for your interest.

Windows DLL depends upon debug DLL

Based upon this discussion: https://groups.google.com/forum/#!topic/serial-communication-manager/pZIrrdn43nY it appears that the windows DLL depends upon MSVCR120D.DLL (as well as IESHIMS.DLL).

I'm not a Windows C++ developer, but from what I've read it appears that the *D.DLL files are debug only and not redistributable, and I've been unable to figure out how to get a copy of MSVCR120D.DLL (I installed VS 2013 Community edition, but still can't find the DLL anywhere - not sure if I need to build something that uses it?).

Ideally the binaries included with the Java library should not require additional DLLs to be installed - but if this is not possible it would be preferable if the libraries were available from the Microsoft Visual C++ redistributable download.

occasionally corrupted data when sending on macOS + CP2102

I observed occasionally corrupted data (about every 20 times) when sending a simple String (about 10 chars) as byte array via writeBytes(serialHandle,data) on macOS 10.12.3 using CP2102 USB-Serial converter.

The same code using Bluetooth serial connection works (to HC-05 BT-UART-Dongle).
The same code on Win10 works with both, CP2102 and Bluetooth.

When using jssc, there are no issues with the combination macOS + CP2102

I assume some issue with the driver communication.

SerialComUSB: Raspi 4 is not supported

Hello Rishi,

On a Raspi 4 the SerialComUSB shows the following exception:

com.serialpundit.core.SerialComException: Could not identify CPU architecture. Please report to us your environemnt so that we can add support for it ! at com.serialpundit.usb.SerialComUSB.<init>(SerialComUSB.java:126)

I don't know what information you need but here is the cpuinfo:
Fetched information from cpuinfo: {BogoMIPS=108.00, Serial=10000000e3dca492, Revision=c03111, Model=Raspberry Pi 4 Model B Rev 1.1, CPU=revision : 3, Features=fp asimd evtstrm crc32 cpuid, Hardware=BCM2835, processor=3}

tty2com -- cannot read meta info

Hi,

i just compiled and installed tty2com driver. All seems OK, I am able to communicate with picocom and by python serial library and no errors in log. But i am not able to read meta info, as described in README:

LANG=C head -c 46 /proc/sp_vmpscrdk
head: error reading '/proc/sp_vmpscrdk': Invalid argument

The cat provides the same error message. The sp_vmpscrdk permissions:

ls -l /proc/sp_vmpscrdk
-rw-rw-rw- 1 root root 0 mar 17 15:23 /proc/sp_vmpscrdk

Kernel version:

uname -rsvo
Linux 4.14.12-2 #1 SMP Sun Jan 7 15:31:02 CET 2018 GNU/Linux

Shared library not in sp-tty.jar

Hi!

I want to test my USB-Relay/CP2104 with your test77 example. Unfortunately the lib cannot load the shared lib:

"Can not get shared library spcp210xrwinx64.dll resource as stream from sp-tty.jar file !"

Indeed, in the sp-tty.jar there is no such file. Currently not implemented?

Error executing Getting Started example.

I am trying to execute the Example here https://github.com/RishiGupta12/serial-communication-manager, in Getting Started.

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/scm_tuartx1/linux_1.0.4_x86_64.so: libudev.so.0: Não é possivel abrir arquivo de objetos compartilhado: Arquivo ou diretório não encontrado
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.embeddedunveiled.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:335)
at com.embeddedunveiled.serial.SerialComManager.(SerialComManager.java:581)
at Main.main(Main.java:11)

Thread don't resume correctly

I created an web apps with spring boot. When application start, I start to do a blocking read on the serial port. I use serialPundit library.

  @Component
    public class ScanApplicationStartup implements ApplicationListener<ApplicationReadyEvent> {
        @Autowired
        public ScanRead scanRead;

        @Override
        public void onApplicationEvent(final ApplicationReadyEvent event) {
            scanRead.run();
        }
    }

My thread code

@Component
    public class ScanRead implements Runnable {

        @Autowired
        private SerialComManager scm;

        private long handle;
        private long context;

        Thread thrd;
        boolean suspended;
        boolean stopped;

        String port = "/dev/ttyUSB0";

        final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();

        public String bytesToHex(byte[] bytes) {
            char[] hexChars = new char[bytes.length * 2];
            for (int j = 0; j < bytes.length; j++) {
                int v = bytes[j] & 0xFF;
                hexChars[j * 2] = hexArray[v >>> 4];
                hexChars[j * 2 + 1] = hexArray[v & 0x0F];
            }
            return new String(hexChars);
        }

        @Override
        public void run() {
            System.out.println("run");
            try {

                handle = scm.openComPort(port, true, false, true);
                scm.configureComPortData(handle, DATABITS.DB_8, STOPBITS.SB_1, PARITY.P_NONE, BAUDRATE.B9600, 0);
                scm.configureComPortControl(handle, FLOWCONTROL.NONE, 'x', 'x', false, false);
                context = scm.createBlockingIOContext();

                while (true) {

                    StringBuilder sb = new StringBuilder();

                    byte[] dataRead = {};

                    for (int x = 0; x < 8; x++) {
                        dataRead = scm.readBytesBlocking(handle, 1, context);
                        if (dataRead != null) {
                            sb.append(bytesToHex(dataRead));
                        }
                    }

                    System.out.println("run" + sb.toString());

                    synchronized (this) {
                        while (suspended) {
                            wait();
                        }
                        if (stopped) {
                            break;
                        }
                    }

                }
            } catch (InterruptedException exc) {
                System.out.println(thrd.getName() + " interrupted.");
                System.out.println("run 1: " + exc.getMessage());
            } catch (IOException ex) {
                Logger.getLogger(ScanRead.class.getName()).log(Level.SEVERE, null, ex);
                System.out.println("run 2: " + ex.getMessage());
            }
        }

        public synchronized void stop() {
            System.out.println("stop");
            stopped = true;
            suspended = false;
            notify();
        }

        public synchronized void suspend() throws SerialComException {
            suspended = true;
            System.out.println("suspend");
            scm.unblockBlockingIOOperation(context);
            scm.destroyBlockingIOContext(context);
            scm.closeComPort(handle);
        }

        public synchronized void resume() throws SerialComException {
            System.out.println("resume");
            suspended = false;
            handle = scm.openComPort(port, true, false, true);
            scm.configureComPortData(handle, DATABITS.DB_8, STOPBITS.SB_1, PARITY.P_NONE, BAUDRATE.B9600, 0);
            scm.configureComPortControl(handle, FLOWCONTROL.NONE, 'x', 'x', false, false);
            context = scm.createBlockingIOContext();
            notify();
        }

    }

If a member don't have a card assigned, I don't want to suspend the thread, do another process on the serial port and resume the thread.

When a user don't have a card assigned, I have this code who need to be called.

 @GetMapping(value = "/members/{memberId}/card")
        public ResponseEntity<Void> updateMemberCardId(@PathVariable("memberId") Long memberId) {

            System.out.println("updateCardId");
            StringBuilder sb = new StringBuilder();
            try {
                String port = "/dev/ttyUSB0";

                scanRead.suspend();

                long handle = scm.openComPort(port, true, false, true);
                byte[] dataRead = {};

                scm.configureComPortData(handle, SerialComManager.DATABITS.DB_8, SerialComManager.STOPBITS.SB_1, SerialComManager.PARITY.P_NONE, SerialComManager.BAUDRATE.B9600, 0);
                scm.configureComPortControl(handle, SerialComManager.FLOWCONTROL.NONE, 'x', 'x', false, false);

                long context = scm.createBlockingIOContext();

                for (int x = 0; x < 8; x++) {
                    dataRead = scm.readBytesBlocking(handle, 1, context);
                    if (dataRead != null) {
                        sb.append(bytesToHex(dataRead));
                    }
                }

                System.out.println(sb.toString());

                scm.unblockBlockingIOOperation(context);
                scm.destroyBlockingIOContext(context);
                scm.closeComPort(handle);

                scanRead.resume();

                memberService.updateMemberCardId(sb.toString(), memberId);

            } catch (IOException ex) {
                Logger.getLogger(MemberController.class.getName()).log(Level.SEVERE, null, ex);
                System.out.println("updated " + ex.getMessage());
            }
            return new ResponseEntity<>(HttpStatus.NO_CONTENT);
        }

It's seem to have an issue about the thread.

When I start the application,

run is displayed.

I do a call to this URL: http://localhost:8080/members/1/card No card assigned.

theses string are displayed

updatedCardId
suspend

run 2: I/O operation unblocked !

I pass a card over the scanner

theses string are displayed
id
resume

Thread don't seem to run anymore because if I try to scan the card again, nothing happen. Nothing is displayed. Just don't understand because there is only one who have access to serial port.

Sometime get another result

run
run before read
updateCardId
suspend
updateCardId: before read

scan the card, but nothing happen,
scan the card again and get

updateCardId: after read
updateCardId: E00124ABF84CE001
resume

Card id should be E004010024ABF84C, seem like some issue can happen with the read

OS X 10.9.5 Library Versions

Hi,

I am on mac OS X 10.9.5 and use System.out.println(scm.getLibraryVersions()) to get the versions of the libs. However it looks like there is a mismatch between the Java and native lib.

Java lib version: 1.0.3
Native lib version: 1.0.2

Are the Versions compatible?

Thanx,
Rtg

JNI call ThrowNew failed to throw exception

Hello Rishi,
I tried to run the example but I got this error in the Eclipse console, what does it mean or why it happens?

JNI call ThrowNew failed to throw exception !, FormatMessageA(), error code : 15100
com.serialpundit.core.SerialComException: 
	at com.serialpundit.serial.internal.SerialComPortJNIBridge.openComPort(Native Method)
	at com.serialpundit.serial.SerialComManager.openComPort(SerialComManager.java:618)
	at paquetePruebaSerial.Example.main(Example.java:14)

The line 14:

            long handle = scm.openComPort("COM5", true, true, true);

I was working on a machine with Win8.1 (AMD64)

XP Compatibility

Is SCM compatible to Windows XP ?
I tried to run the prebuilt-release scm-1.0.4.jar on Windows XP SP3 but I can't get it work.

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
C:\Users\xxx\AppData\Local\Temp\scm_tuartx1\windows_1.0.4_x86.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1822)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.embeddedunveiled.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:336)
at com.embeddedunveiled.serial.SerialComManager.<init>(SerialComManager.java:582)
at demo.Demo.main(Demo.java:14)

I added the missing MSVCR120.DLL to system32 directory but
still Dependency walker shows a problem with the following 2 DLLs.

ADVAPI32.DLL  (RegGetValueW  *function is marked red)
SETUPAPI.DLL  (SetupDiGetDevicePropertyW *function is marked red)

How to detect Parity errors?

The library won't enable parity check on Windows 10 x64.

I've tried this example that you provided https://github.com/RishiGupta12/SerialPundit/tree/master/applications/d1-blocking-read-com

with enabling ParFraError like this:

scm.configureComPortControl(handle, FLOWCONTROL.NONE, 'x', 'x', true, false);

after this i printed:

System.out.println(Arrays.toString(scm.getCurrentConfiguration(handle)));

and i got this:

[DCBlength : 28, BaudRate : 19200, fBinary : TRUE, fParity : FALSE, fOutxCtsFlow : FALSE, fOutxDsrFlow : FALSE, fDtrControl : DTR_CONTROL_ENABLE, fDsrSensitivity : FALSE, fTXContinueOnXoff : TRUE, fOutX : FALSE, fInX : FALSE, fErrorChar : FALSE, fNull : FALSE, fRtsControl : RTS_CONTROL_ENABLE, fAbortOnError : FALSE, fDummy2 : NA, wReserved : NA, XonLim : 2048, XoffLim : 2048, ByteSize : 5, Parity : 1, StopBits : 0, XonChar : �, XoffChar : �, ErrorChar : , EofChar : , EvtChar : , wReserved1 : NA]

fParity is false, but it should be true

Application Crash when starting multiple instance even using new prebuilt releases

Hi
Thanks for maintaining this great library.
I Imported the serilapundit application "serial terminal emulator" in my eclipse workspace,
and opened two instance. As soon as I clicked open button selecting one of the port the other instance terminated, throwing a fatal error and producing an error file. I tried it on Windows as well as on Linux both 32bit and 64bit platform and the problem is same. I am attaching the eclipse console output and the generated error file. Kindly look into the matter.

Eclipse Console Output:-

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00003986, pid=8279, tid=1742400320

JRE version: OpenJDK Runtime Environment (7.0_91-b02) (build 1.7.0_91-b02)

Java VM: OpenJDK Server VM (24.91-b01 mixed mode linux-x86 )

Derivative: IcedTea 2.6.3

Distribution: Ubuntu 14.04 LTS, package 7u91-2.6.3-0ubuntu0.14.04.1

Problematic frame:

C 0x00003986

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

An error report file with more information is saved as:

/workspace/Serial terminal emulator/hs_err_pid8279.log

If you would like to submit a bug report, please include

instructions on how to reproduce the bug and visit:

http://icedtea.classpath.org/bugzilla

hs_err_pid8279.log.zip

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.