Mailing list archives : pcb-rnd

ID:5116
From:rn...@igor2.repo.hu
Date:Sat, 4 Sep 2021 18:26:27 +0200 (CEST)
Subject:Re: [pcb-rnd] [electronics] minilib and utility for DMM serial
in-reply-to:5114 from Majenko Technologies <ma...@majenko.co.uk>
replies: 5117 from Majenko Technologies <ma...@majenko.co.uk>
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
 
--722076672-2101440543-1630772787=:25382
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8BIT
 
 
 
On Sat, 4 Sep 2021, Majenko Technologies wrote:
 
>I'm thinking a library that deals just with the device io. No protocols,
>just getting the raw data. Plugins for serial, HID Serial, raw USB packets,
>etc. libut61x uses it to get the data from the device, and you specify what
>plugin to use to get that data from the device. My programmes also use it to
>get the data from the devices, etc. 
>
>Like hid-rnd but for device io not human io.
 
Sorry, that's what I don't believe in. If you look at the code, the 
part that deals with the low level io, the ports, that's ut61_port_open() 
and is 30 sloc. The rest of the code is ut61 specific.
 
That 30 sloc needs to set a few things that only this specific device 
needs: a fixed baud rate, a combination of RTS and DTR to power the 
adapter. Of course you could bloat up this 30 sloc into 300 to have 
everything configurabxle, but then you just have a wrapper around termios, 
just an excess layer. It's easier to use termios directly.
 
For the USB part: normally any usb serial converter would just have a 
driver so you get a tty device. That's the abstraction of UNIX. Looking 
at the sigrok code, this USB HID is just reimplementing the usual serial 
port stuff, baud rate, parity, then read and write bytes. Instead of 
inventing yet another software layer above libusb and termios, the proper 
solution would be to write a serial driver for this device or if a driver 
is overkill, emulate it over pty.
 
 
Best regards,
 
Igor2
 
--722076672-2101440543-1630772787=:25382--
 

Reply subtree:
5116 Re: [pcb-rnd] [electronics] minilib and utility for DMM serial from rn...@igor2.repo.hu
  5117 Re: [pcb-rnd] [electronics] minilib and utility for DMM serial proto from Majenko Technologies <ma...@majenko.co.uk>