#StackBounty: #python #serial-port #ros #lidar #slam RPLIDAR A1 not sampling as fast as expected with python

Bounty: 50

using the A1 lidar from RPLIDAR, and one of the python3 libraries that implement the SDK (in my case it’s rplidar library), I couldn’t get the lidar to sample the points as fast as the documentation suggests, i.e. it should reach 8000 points/sec and i’m at the maximum at 1000points/sec (5.5Hz*170), and that’s really not enough for my usage (creating a 3D mesh from pointcloud)

the code I use to check speed is here:
https://github.com/SkoltechRobotics/rplidar/blob/master/examples/measure_speed.py
and the code to get the number of measurements per scan is the sample in the readme.

I get this results:

enter image description here

Does anyone know how to implement the full sampling rate of the lidar, from the Python API?
I work either from raspberry or Windows. If the solution could be 100% python it would be really best.
Thanks,


Get this bounty!!!

#StackBounty: #c++ #qt #serial-port #qt5 #serial-communication Sending hex data via serial communication with QT

Bounty: 50

I am finding way to send hex data via serial communication
i searched it several times and followed some ways but it didn’t work.
i checked that protocol is working with using other software that sending hex data to device
below is my code

const char data[]={0xAA,0xAA,0x01,0x00,0x00,0x0E,0x00,0x01,0x00,0x00,0x00,0x2D,0x37,0x1D,0xAA,0xAA,0x01,0x00,0x00,0x0E,0x00,0x0C,0x10,0x00,0x00,0x01,0x76,0x13}; 
serial->setPortName(("COM8"));
initSerialPort(); // baud rate and etc

if(serial->open(QIODevice::ReadWrite))
{
    qDebug()<<"Port is open!";
    if(serial->isWritable())
    {
        qDebug()<<"Yes, i can write to port!";
       int size = sizeof(data);
       serial->write(data,size);
    }
}

and when i use other declare like uint16_t, uchar, write function cannot convert argument 1 from uint16_t (or uchar) to const char *

i did try also this form

QByteArray hex("AAAA0100000E00010000002D371DAAAA0100000E000C100000017613");
QByteArray data = QByteArray::fromHex(hex);

and it also didnt work


Get this bounty!!!

#StackBounty: #linux #usb #serial-port Trying to read a serial port, device or resource busy

Bounty: 50

I’m trying to read the data from a GPS module. It uses TTL communication and I have an adapter to convert it to USB which is connected to my computer.

I can get data from it using cgps, but I need to have more base level communication with it.

When I try

gpscat -s 9600 /dev/ttyUSB0

I get

OSError: [Errno 16] Device or resource busy: ‘/dev/ttyUSB0’

I’ve tried lsof, fuser, ps -ef | grep, ps aux | grep, and I can’t figure out what is using the port and thus I can’t stop it.


Get this bounty!!!

#StackBounty: #kernel #drivers #usb #windows #serial-port USB gadget serial-port (g_serial or composite): how do I control what name Wi…

Bounty: 50

I’m trying to add a gadget-serial interface to my project, either by way of modprobe g_serial or by way of a composite/configfs method.

I have a little script (shown below) that works perfectly when talking to a MacOS or a Linux host. And it also works when talking to a Windows host, except that the name is always wrong.

When connected to a Windows host, my gadget always shows up in the Device Manager as "USB Serial Device (COM)" instead of showing up with the right product name. Windows also lists the device’s manufacturer as Microsoft, regardless of what I set in strings/0x409/manufacturer. And the gadget’s serial-number is nowhere to be found.

How do I change this behavior? Is there some kind of magic I can do with /sys/kernel/config/usb_gadget/usb_gadget/g1/os_desc to make Windows pick up the manufacturer, product, and serialnumber fields correctly? Or is there some kind of .inf magic that I need to do on Windows?

I tried using g_serial originally, with the following command:

modprobe g_serial 
    idVendor="0x4075" 
    idProduct="0x0001" 
    iSerialNumber="0123456789" 
    iManufacturer="Magic Manufacturing" 
    iProduct="Gizmomatic Machine"

When I couldn’t get the name to appear correctly, I tried a configfs/gadget-serial approach instead:

#!/bin/bash

set -euo pipefail

mkdir /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1

echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol

echo "0x4075" > idVendor
echo "0x0001" > idProduct

mkdir strings/0x409
echo "0123456789" > strings/0x409/serialnumber
echo "Magic Manufacturing" > strings/0x409/manufacturer
echo "Gizmomatic Machine" > strings/0x409/product

mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "acm" > configs/c.1/strings/0x409/configuration

mkdir functions/acm.usb0
ln -s functions/acm.usb0 configs/c.1

echo "ci_hdrc.0" > UDC

Both variants "work" in the sense that they create a working COM-port in Windows. But neither one reports the right serial-number, manufacturer, or product name. If anybody’s got some words of wisdom here, it would help me out a lot. I’m on the 4.19.35 kernel if it matters.


Get this bounty!!!

#StackBounty: #drivers #kernel #serial-port #modprobe How to unload a kernel module which is in use and has a recursive module dependen…

Bounty: 100

I habe a driver for my ELM 327 an it uses the pl2303 module which depends on the usbserial and this again depends on the pl2303 module.

What I tried:

sudo modprobe -r usbserial pl2303
sudo modprobe -r pl2303 usbserial
sudo modprobe -rf usbserial
sudo modprobe -rf pl2303
sudo rmmod --force pl2303
sudo rmmod --force usbserial

result of rmmod:

rmmod: ERROR: ../libkmod/libkmod-module.c:799 kmod_module_remove_module() could not remove 'usbserial': Resource temporarily unavailable
rmmod: ERROR: could not remove module usbserial: Resource temporarily unavailable

result of modprobe:

modprobe: FATAL: Module usbserial is in use.

Also I tried it with the drivers loaded and unloaded.

kernel modules reference each other[1]

OS: Ubuntu 20.04


Get this bounty!!!

#StackBounty: #windows #serial-port #windev Getting DTR and RTS pin of serial port in C on Windows platform

Bounty: 50

How to get DTR and RTS status of serial port on a windows platform? I want to read the current state (ON or OFF) of these two pins.

I can set pins with :

EscapeCommFunction(hSerial,SETRTS);

But I don’t know how to read the pin status.

Since on Linux, it can be done with the following code, I assume it is technicaly feasable:

int status=0;
ioctl(fd, TIOCMGET, &status);
return status & TIOCM_RTS;


Get this bounty!!!

#StackBounty: #usb #uefi #serial-port How to take a serial port connection via USB online?

Bounty: 150

I’d like be able to establish a connection to a headless Ubuntu 18.04 server from a Ubuntu 18.04 laptop via serial console in order to avoid having a graphic card consuming energy in the server.

The motherboard is an ASRock X99 Extreme3. Its UEFI has an option to enable/disable the serial port which I set to enable – smart as I am – and to select 3F8h/IRQ4 or 3E8h/IRQ4 for the “Serial Port Address” where I left the initially selected 3F8h/IRQ4 without knowing what the values stand for.

The laptop doesn’t have a serial port, so I use a Serial-USB adapter which causes

[ 4303.030466] pl2303 3-1.1:1.0: pl2303 converter detected
[ 4303.031471] usb 3-1.1: pl2303 converter now attached to ttyUSB0

to be printed in dmesg after it’s plugged-in.
On the server side the output of dmesg | grep tty is

[ 0.218803] printk: console [tty0] enabled
[ 2.079815] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A

I read about the possibility to specify a serial console to GRUB and related kernel parameters, however I don’t find any clear statement whether that’s necessary or not to be able to connect after the system booted (I don’t need to be able to connect to GRUB’s console for now).

When I try to connect to the server using

sudo minicom -D /dev/ttyUSB0

or putty, I see

CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB0 

in the footer for the former and both terminals don’t take any input. I payed attention to match the device file to connect to with the one printed in dmesg.

I’m suspicious that I don’t have to install or configure anything on the server side except turning on the serial port in the UEFI. Can that be correct?

Maybe the BAUD rate isn’t negotiated automatically and needs to be configured, but I have no idea how to figure out the correct value. I ran the configuration for minicom, but could only select default values because I don’t find a good explanations – in all tutorials the connection just magically works after minicom -s apparently. I added the desktop user account and root to the groups dialout and uucp.

I can provide arbitrary information from both server and laptop.


Get this bounty!!!

#StackBounty: #gnu-screen #serial-port #file-transfer #serial-console Connected using screen over RS-232. How do I transfer a file to m…

Bounty: 50

I’m connected to a device over a serial cable and using screen I have full access to the remote system.

How do I transfer an entire file(s) to my local system? Not just the contents of the file, I want the whole thing. I need to send this file as a sample to a third party so they’ll want to see metadata, encoding, etc. I want to copy the file exactly as it is, the data it contains isn’t really that important.

The remote system is Linux, but a proprietary box so I can’t guarantee what tools it has. Local system is running Xubuntu Xenial. I can install packages onto my machine, but not the remote one. My connection is over a USB serial adaptor, so screen is connecting through a USBtty.


Get this bounty!!!