Recent

Author Topic: How to talk to a CDC USB device on MacOs or Linux ?  (Read 894 times)

lucydog11

  • Newbie
  • Posts: 3
How to talk to a CDC USB device on MacOs or Linux ?
« on: February 04, 2023, 03:26:30 am »
With Delphi i use a serial port driver  to talk to my USB controller board .

How do i talk to USB ports on Linux or MacOS ( im working with both) ?   Its a PIC based USB board that uses CDC  ( serial protocal using ascii )

Larry K
« Last Edit: February 04, 2023, 03:31:13 am by lucydog11 »

Curt Carpenter

  • Sr. Member
  • ****
  • Posts: 396
Re: How to talk to a CDC USB device on MacOs or Linux ?
« Reply #1 on: February 04, 2023, 03:59:55 am »
Not sure what you're asking here.  Your CDC hardware is connected to your PC with a USB cable?  Or something else?

Check out the packages "SdpoSerialLaz" or synaSER and see if they look like what you're after:  they let you communicate with a device in a serial mode via a USB port.  (I use synaSER to talk to most of my development boards here.) 

Hope that's responsive to what you're looking for.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to talk to a CDC USB device on MacOs or Linux ?
« Reply #2 on: February 04, 2023, 09:02:24 am »
On unix (definitely including Linux, probably including MacOS or whatever it's called these days) it's a standard serial device. My own preference is to use the standard serial.pp (with a separate thread if necessary), there's a couple of demos plus some useful additional stuff to find the device etc. at https://github.com/MarkMLl/serialcomms

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

lucydog11

  • Newbie
  • Posts: 3
Re: How to talk to a CDC USB device on MacOs or Linux ?
« Reply #3 on: February 04, 2023, 08:15:57 pm »
Ok, thanks i will try those two suggestions .  I'm just getting use to lazasus now, but i'm really impressed . I was able to install a component i had wrote for delphi ..into Lazarus last night . 

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to talk to a CDC USB device on MacOs or Linux ?
« Reply #4 on: February 05, 2023, 10:22:26 am »
I'm spending limited time on the forum these days, but is you have urgent questions about serial.pp or the link I gave you also PM me since I'll get a notification via email.

serial.pp is very much intended to be low-level. I did quite a lot of work on it when I was doing RS232 monitoring work, and it's done in such a way that you can e.g. have a thread that responds to each received character by storing it with a timestamp and snapshot of the control lines.

It's tested on both Linux and SunOS/Solaris, but hasn't been explicitly tested on a Mac. That's important, since my understanding is that both MoacOS and SunOS are BSD derivatives, and BSD's implementation of the select() syscall differs from the way is was later done by Linux.

The stuff I linked to can help when you're trying to find the device name (i.e. /dev/ttyUSBnn etc.) of e.g. a measurement instrument you've just plugged in.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018