serial-port

How do I bridge two physical serial ports to each other in software (and log the data going across)?

 ̄綄美尐妖づ 提交于 2020-01-01 10:31:39
问题 Basically, I want to put my computer in the middle of a serial line and record the conversation going across it. I'm trying to reverse engineer this conversation and eventually emulate one end of the conversation. Rough Diagram of what I'm trying to do: Normally, I have this: __________ __________ | | | | |Device 1|<======>|Device 2| |________| |________| I want to do this: __________ __________ __________ | | | | | | |Device 1|<===>|Computer|<===>|Device 2| |________| |________| |________|

Custom baud rate

妖精的绣舞 提交于 2020-01-01 10:08:13
问题 I am trying to talk with hardware device through virtual COM port. Host computer is PC Windows OS PC. Device is working with 921600 baud rate. This code works: DCB dcb; ... dcb.BaudRate = CBR_115200; SetCommState(hPort, &dcb); Once I change baud rate: dcb.BaudRate = 921600; SetCommState fails with last error 0x57 (parameter is incorrect). Does this mean that Windows API prevents any baud rate except predefined values? Or maybe, virtual COM port may be configured to allow this baud rate?

Programmatically talking to a Serial Port in OS X or Linux

不想你离开。 提交于 2020-01-01 08:04:35
问题 I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial . When i do this everything seems to be hunky-dory: stty -f /dev/cu.usbserial speed 9600 baud; lflags: -icanon -isig -iexten -echo iflags: -icrnl -ixon -ixany -imaxbel -brkint oflags: -opost -onlcr -oxtabs cflags: cs8

C# - readin from serial port buffer

岁酱吖の 提交于 2020-01-01 06:34:09
问题 I am trying to read data from an RS-232 port. Does anyone have an example of how I get the data from the port/buffer and make sure that I have all the data as it can be multiline data. Do I simply read it as follows ? string Rxstring = port.ReadLine(); Console.WriteLine(Rxstring); 回答1: Try this: using System.IO.Ports; ... private SerialPort port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One); Console.WriteLine(port.ReadExisting()); Details can be found at Coad's Code. 回答2: Q:

Batch-File: Receive Data from the Serial-Port and write it into txt-File

爱⌒轻易说出口 提交于 2020-01-01 05:59:26
问题 I'm trying to extract some data from an Arduino over the usb-serial-port and to write it into a txt-file. Therefore i'm using a batch-file (Windows 7, ordinary cmd), which sends e.g. a "d" to request the desired data from the Arduino. Having received the "d", the Arduino starts to send the data to the pc. The batch-file reads the data and writes it to some txt-file. The batch code is: mode COM4 BAUD=9600 PARITY=n DATA=8 echo d >COM4 COPY COM4 data.txt That works so far, but the problem is:

Pyserial does not play well with virtual port

放肆的年华 提交于 2019-12-31 22:48:11
问题 Motivation I want to start leraning how to use the python library Pyserial. It seems like a really nice library that works for a lot of people. I want to use it for an upcoming project in which I have to automate serial communications. Environment I'm running Ubuntu 15.04. I'm using Python 2.7. Setting up virtual ports I don't currently have a device that I can communicate with over a serial port. I'm using the socat application to create two virtual ports that are connected to each other

gnu.io.PortInUseException: Unknown Application?

淺唱寂寞╮ 提交于 2019-12-31 22:43:32
问题 void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { System.out.println(portIdentifier.getCurrentOwner()); CommPort commPort = portIdentifier.open(this.getClass().getName(),2000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200

How to communicate with USB 3G modem?

好久不见. 提交于 2019-12-31 21:34:46
问题 I have a D-Link DWM-156 3G USB modem that I want to send AT-commands to from my application (C# .NET 4.0 running on Windows XP SP3). After plug-in and installation of drivers the modem shows up like this: In Device Manager , two serial ports are added: D-Link HSPADataCard Diagnostics Interface (COM4) D-Link HSPADataCard NMEA Device (COM5) In Control Panel, Phone and Modem Options , a new modem is added: D-Link HSPADataCard Proprietary USB Modem (attached to COM19) QUESTION: Which com port

Unable to read data from socket, can not bind to address in php

怎甘沉沦 提交于 2019-12-31 06:09:24
问题 I have a weighing scale connected to a client pc with a serial port. The client PC is installed with SERPROXY. Using telnet xx.xx.xx.xx port 25003, the data is shown successfully. It means SERPROXY is working fine and port forwarding is done properly in router too. I will share the real public ip upon request to see the data using telnet. How do I about to read and echo it on the web page ? The following piece of code fails on binding using sockets? error_reporting(E_ALL); // Server IP

rs 232 pin configuration in linux pc

…衆ロ難τιáo~ 提交于 2019-12-31 05:21:35
问题 There are a lot of examples which shows on how to communicate through the serial port of the pc. But is there a way to configure the pins of rs 232? I just need to set the tx pin for some time and then reset it and so on. is there a way to find the address of the pins of rs 232? Thank you. If there is an address then how can we access the pin or change the state of the pin in that address? 回答1: Control Pins For the other pins DTR CTS etc, you will need to use ioctl() to toggle the pin. Here