How to find /dev/ name of USB Device for Serial Reading on Mac OS?
Asked Answered
V

3

38

I am trying to plug in a device into my Macbook and connect to it to read it's serial port. I know the device connects on baudrate 115200.

Currently, I run the command

ioreg -p IOUSB -l -b | grep -E "@|PortNum|USB Serial Number"

I can see the embedded device plugged in

+-o Root Hub Simulation Simulation@14000000
| +-o iBridge@14200000
| |     "PortNum" = 2
| +-o USB2.0 Hub@14100000
|   |   "PortNum" = 1
|   +-o 4-Port USB 2.0 Hub@14120000 
|   | |   "PortNum" = 2
|   | +-o MBED CMSIS-DAP@14122000
|   |       "PortNum" = 2
|   |       "USB Serial Number" = "024002267822ce0a00000000000000000000000085fb33b2"
|   +-o USB Keyboard           @14110000 
|         "PortNum" = 1
|         "USB Serial Number" = "0000000000000001"

note: There's a tag close to

<class AppleUSBDevice, id 0x100014343, registered, matched, active, busy 0 (363 ms), retain 33>

next to every device's name above, but I removed them for formatting issues (as I don't think they're related to the question). In the event they are, that is the tag for my embedded device).

The Question

How would I find out the MBED device's association in /dev/?

I am trying to find the device MBED CMSIS-DAP@14122000 inside the /dev/ directory, so that I can read its serial output. This is where I am lost.

The end goal is that I could use screen or putty or something similar to:

screen /dev/ttyTHIS_MBED_DEVICE 115200

Variscite answered 16/1, 2018 at 23:19 Comment(0)
V
47

So, I actually found the answer.

To find out what the device name is, I did an ls of the /dev/ directory with the device plugged in and then with it disconnected.

ls -lha /dev/tty* > plugged.txt
ls -lha /dev/tty* > np.txt

Then I compared the files using

vimdiff plugged.txt np.txt

And saw the line

crw-rw-rw- 1 root wheel 19, 30 Jan 16 15:24 /dev/tty.usbmodem145222

Sure enough, the device is named tty.usbmodem145222!

Variscite answered 16/1, 2018 at 23:31 Comment(3)
Right! Don't forget to use -a in your ls !Monney
Please help me it is giving me this output: + +--133 lines: crw-rw-rw- 1 root wheel 2, 0 Feb 19 21:43 /dev/tty---------------------|+ +--133 lines: crw-rw-rw- 1 root wheel 2, 0 Feb 19 21:43 /dev/tty--------------------Aeriel
@Aeriel use diff plugged.txt np.txt | less insteadMonney
Z
15

Please try

ls /dev/tty* | grep usb
Zadazadack answered 14/3, 2020 at 11:45 Comment(0)
B
3

Answer when running MacOS 14.3 on M2 Apple Processor

I was able to run system_profiler SPUSBDataType on the command line and find my device.

FT232R USB UART:
Product ID: 0x6001
Vendor ID: 0x0403 (Future Technology Devices International Limited)
Version: 6.00
Serial Number: AB0O4KAS
Speed: Up to 12 Mb/s
Manufacturer: FTDI
Location ID: 0x01110000 / 4
Current Available (mA): 500
Current Required (mA): 90
Extra Operating Current (mA): 0

Then running ls -lha /dev/ | grep AB0O4KAS (the serial number) gave me the device name:

tty.usbserial-AB0O4KAS

Badillo answered 28/3 at 0:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.