serial-port

Associate physical usb port to device

偶尔善良 提交于 2021-02-10 07:33:28
问题 I'm curently working on a testbench for some pcbs. They can be controlled though USB. I wrote some python code to send (using pySerial) orders to one card via the serial device "/dev/ttyACM0" The problem is that I need to test 5 cards at a time which means I need to differentiate which card is controlled with “/dev/ttyACM*” and * depends on the pluging order (which I don’t control). I used “usb-devices” command to have the name of each physical usb port but I need to send orders to these via

How to distinguish identical USB-to-serial converter?

假如想象 提交于 2021-02-08 09:51:30
问题 I have 2 identical USB-to-serial adapter cables (pretty much like this one) to connect a desktop PC under Ubuntu and some RS232 devices. I develop a python software to pilot these devices. I need to find a way to identify which one of the 2 adapters I am connected to. I know about python's serial.tools.list_ports.comports() function, but all the settings are the exact same for both adapters (see capture below). Except the device , but it may change depending on the plugging order. How can I

Beaglebone Black Serial c++

亡梦爱人 提交于 2021-02-08 08:27:23
问题 It seems to be a pain to get serial working in c++, adding to that, to do it on the Beaglebone Black is hard, so I need someone with some expertise! I created /dev/ttyO4 with the following command: echo BB-UART4 > /sys/devices/bone_capemgr.9/slots This gives me /dev/ttyO4. I then write a small program in cpp using a library linked here. My code is found below: #include <stdio.h> #include "serialib.h" #if defined (_WIN32) || defined( _WIN64) #define DEVICE_PORT "COM1" // COM1 for windows

Import with files names conflict

╄→гoц情女王★ 提交于 2021-02-08 07:39:39
问题 I'm trying to develop a simulation class that replaces serial at specific apps(Win7, python 2.7). I have a SerialHandle class that works in number of apps, It's job is add logic to the well known serial methods, the idea was to replace python serial.py with a dummy file with the same name so we won't have to change and imports at SerialHandle . Now i have this file with Serial class just like the origin and it works fine: serial.py ...Serial() Since i want to really simulate the methods i

How to write integers to port using PySerial

99封情书 提交于 2021-02-07 12:48:31
问题 I am trying to write data to the first serial port, COM1, using PySerial. import serial ser = serial.Serial(0) print (ser.name) ser.baudrate = 56700 ser.write("abcdefg") ser.close() ought to work. However, I need to send 28 bytes of integers constantly; in the form 255 255 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 on loop, with each integer using one byte of data. Trying: import serial ser = serial.Serial(0) print (ser.name) ser

How to write integers to port using PySerial

眉间皱痕 提交于 2021-02-07 12:48:19
问题 I am trying to write data to the first serial port, COM1, using PySerial. import serial ser = serial.Serial(0) print (ser.name) ser.baudrate = 56700 ser.write("abcdefg") ser.close() ought to work. However, I need to send 28 bytes of integers constantly; in the form 255 255 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 on loop, with each integer using one byte of data. Trying: import serial ser = serial.Serial(0) print (ser.name) ser

How can I set the RTS with ioctl() in a Mac plugin?

你。 提交于 2021-02-07 11:20:50
问题 I am able to set the RTS with ioctl in a small Terminal app, but not in my Mac plugin code, although both run the same code. In the plugin I can only "get" the serial ports flags/pins, but not "set" them. In the Terminal app I can both "get and "set" them. I get an errno of ENODEV. The error number is 19 and the message is "Operation not supported by device." If this is a security issue (being in the context of a browser) is there a way to get permission to modify the flag with ioctl? I have

Arduino Python3 script

六眼飞鱼酱① 提交于 2021-02-07 09:44:28
问题 I'm trying to use a Python3 script to control an Arduino Mega. This is a simple script to take a line from the keyboard and echo it back through the Arduino. I started with a working Python 2 script from http://petrimaki.wordpress.com/2013/04/28/reading-arduino-serial-ports-in-windows-7/. I can't seem to get the characters I sent back, which is probably a formatting issue. Is this a formatting issue? unicode to ASCII issue? How do I read/write binary/hex data and ASCII text with Python 3 and

Arduino Python3 script

ε祈祈猫儿з 提交于 2021-02-07 09:43:10
问题 I'm trying to use a Python3 script to control an Arduino Mega. This is a simple script to take a line from the keyboard and echo it back through the Arduino. I started with a working Python 2 script from http://petrimaki.wordpress.com/2013/04/28/reading-arduino-serial-ports-in-windows-7/. I can't seem to get the characters I sent back, which is probably a formatting issue. Is this a formatting issue? unicode to ASCII issue? How do I read/write binary/hex data and ASCII text with Python 3 and

Arduino Python3 script

喜夏-厌秋 提交于 2021-02-07 09:43:02
问题 I'm trying to use a Python3 script to control an Arduino Mega. This is a simple script to take a line from the keyboard and echo it back through the Arduino. I started with a working Python 2 script from http://petrimaki.wordpress.com/2013/04/28/reading-arduino-serial-ports-in-windows-7/. I can't seem to get the characters I sent back, which is probably a formatting issue. Is this a formatting issue? unicode to ASCII issue? How do I read/write binary/hex data and ASCII text with Python 3 and