You are not logged in.

#1 2026-04-14 20:12:17

richardrosa
Member
Registered: 2026-04-12
Posts: 1

USB/Serial port weirdness

Greetings All,

Recently I migrated my system to Arch Linux from SUSE.

It appears that everything is working Ok EXCEPT serial/USB port processing with PERL.

I have a PERL script that communicates with various radios using the USB ports.
The routine makes use of the Device::SerialPort library.

This library was installed via PACMAN.

In ARCH, this routine is unable to communicate with any attached radio.

After a LOT of investigation,
    it appears that the issue is with the baud rate setting.
 
I wrote a small PERL script to test this out. 

Using the library to set baudrates, then issuing 'stty' to get the actual baud rate set,
   I got the following results:
     $portobj->baudrate(9600)  stty=> 13 baud
     $portobj->baudrate(19200) stty=> 14 baud
     $portobj->baudrate(38400) stty=> 15 baud
     $portobj->baudrate(57600) stty=> 4096 baud
     $portobj->baudrate(115200) stty=>4098 baud
     
   Very strange.
   
   
   For some additional tests:
     Tried this test with another radio.
     Same incorrect results.
           
     Ran this script on an ARCH distro on a different machine.
     Same incorrect results.
       
     Built a Linux Mint OS on a different partition on the same machine.
     The correct baud rates were set. 
       
     This does NOT appear to be hardware related.   
 
  I attempted to bypass this issue using 'stty -F {port} {baudrate}   
  This kind of helped a bit.   
  However,  one of the  radios I am communicating with requires binary data (00x-ffx).
  For some reason, the binary data is also changing the baud rate.
  I've verified this by issuing a 'stty -F {port}' after a transmission.
 
  I took a quick look at the SerialPort library routine, and it has not been
   updated since 2009. It also appears to be identical (using a compare routine) to the version in SUSE.
   
  Is there some additional setting or application that is needed?
 
  The Kernel version is 6.19.11-arch1-1), and I am running KDE X11.
   

I've included the code snippet used to test:

  
#!/usr/bin/perl
use strict;
use Device::SerialPort qw( :PARAM :STAT 0.07 );
my $port = '/dev/ttyUSB1';   ### Current port of radio

my $portobj =  Device::SerialPort->new($port) ;
if (!$portobj) {
   print "Could not get port object for $port!\n";
   exit;
}
$portobj->user_msg('ON');
$portobj->databits(8);  
$portobj->handshake('none'); 
$portobj->parity("none");
$portobj->stopbits(1);
$portobj->read_const_time(100); 
$portobj->read_char_time(5);    

foreach my $bd ('9600','19200','38400','57600','115200') {
   $portobj->baudrate($bd);
   print "Baud=>$bd\n";
   system "stty -F $port";
}
exit;


   
Thanx for any help.


Richard Rosa

Offline

#2 2026-04-14 20:25:42

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,555

Re: USB/Serial port weirdness

Sounds like https://bbs.archlinux.org/viewtopic.php … 4#p2261294 though that's supposed to be fixed in glibc 2.43

Offline

Board footer

Powered by FluxBB