pyserial

How can i convert Integer to Signed Word in Python (for use with PySerial)?

Hi I'm having some problems making Python talk to a hardware display using pyserial. Some of the display's functions require Signed Word to be sent as arguments after commands (ie. X or Y on display screen). I've been getting by with chr() previously, but that only works with numbers < 255. I've tried the following for conversion but ...

Python PySerial read-line timeout

Hi all I'm using pyserial to communicate with a embedded devise. ser = serial.Serial(PORT, BAUD, timeout = TOUT) ser.write(CMD) z = ser.readline(eol='\n') So we send CMD to the device and it replies with an string of varing length ending in a '\n' if the devise cant replay then readline() times-out and z='' if the devise is interr...

serial port: have to send \n

[edit] Initially I thought this was a pyserial problem but it's not. Basically it's a system problem: Sending anything over the serial port (/dev/ttyS0) would need a "\n" or "\r" or else it'll just be buffered. Below is the original question. Is it a limitation of Linux driver or is there some settings I can change? Hello there, I'm tr...

Writing to COM port on C# or python

Hi, im trying to write a string to a COM4 which is a usb-serial adapter using Visual Studio C# and got the following error: Access to the port 'COM4' is denied. My program is extremely simple: serialport.Open(); serialport.WriteLine("test"); serialport.Close(); I also tried using pyserial with python and got: Traceback (most re...

Twisted's Serialport and disappearing serial port devices

Hi, I'm using twisted.internet.serialport to have my program be continuously connected to a device on a serial port. Unfortunately my serial port is just a usb device, which means it can be disconnected or reset by the OS at any time (port 2 disabled by hub (EMI?), re-enabling... ). I see that pyserial has support for this for a few we...

pySerial getting writeTimeout exeption when sending data

Hi, I'm getting a writeTimeout on a serial connection using pyserial. I have googled a lot and so far i have found nothing. I thought some other might have had the same problem and solved it. However here is my example code ser = serial.Serial('COM10', baudrate=115200, timeout=2, ...

signal.alarm() handler causing problem with pyserial

so i have a motion sensor connected to an avr micro that is communicating with my python app via usb. im using pyserial to do the comm. during my script i have an infinate loop checking for data from the avr micro. before this loop i start a timer with signal.alarm() that will call a function to end a subprocess. when this alarm goes it ...