15

I used to linux USB port naming, aka /dev/ttyUSBxx and currently trying to write some test software to read/write raw data to USB ports on iMac, but i find it hard to detect to which port my usb hardware is connected. I have tried up to a using /dev/ttys"x" but no luck.

In the system information i see the hardware attached at Location ID: 0xfa120000 / 6 maybe this can help somehow?

alex
  • 479,566
  • 201
  • 878
  • 984
edelmaks
  • 193
  • 1
  • 1
  • 10

3 Answers3

16

OS X doesn't create a /dev entry for raw access to USB devices, and there's no way to access them as TTY devices.

Partly this is a different in philosophy between Linux and BSD, partly it's a difference in driver-writing technology, and partly it's a matter of already having a well-defined hierarchy (the IOKit Registry) that would have to be mapped to the /dev hierarchy in some complicated way.

At any rate, if you want to learn how you should access USB devices on a Mac, start with QA1370. If you're looking to do a quick port of some linux code without actually learning IOKit/IOUSB, it's probably going to be impossible. If you're looking for something else, you'll need to give more info about what you're trying to do.

abarnert
  • 354,177
  • 51
  • 601
  • 671
  • 1
    Well, yes, partially i am trying to use an old application, in connection parameters i have to use /dev/ttyUSB"x" where x is the number of the port the device is coveted to. And i write sometimes some programs that let me communicate with hardware over USB. Well, that's the reason – edelmaks Aug 03 '12 at 11:06
  • 1
    For your new programs, you're probably going to want to either (a) write kernel device drivers for the hardware, or (b) use IOKit in the programs to talk to them. And you're going to specify the hardware by finding it in the IO Registry tree rather than the /dev tree. (Type "ioreg" at the Terminal and compare it to what you see from "lsusb" on linux to see why trying to somehow map the results to /dev may not be a great idea.) For the old application, even if the code is too crusty to tear apart without rewriting, you're probably better off faking a file descriptor than a /dev path. – abarnert Aug 03 '12 at 17:53
  • 1
    Thank you abamert. This sounds too new to me. it supposed to be a simple console application to send/receive raw packets from a USB device that has no driver, it's a temperature meter that just will send current temperature upon request from pc.. But seems it's not that easy to accomplish. Is there any example of Mac os usb comms? – edelmaks Aug 03 '12 at 18:03
  • First, is it a USB serial device, or a raw USB device? They're very different. Second, did you look at the link I provided to QA1370, which is full of examples for a wide variety of different things, and not find what you wanted? – abarnert Aug 03 '12 at 19:29
  • 1
    what is the difference between a USB serial device and a raw USB device? – Rishi Jul 19 '15 at 23:50
8

I have a SheevaPlug that acts as a USB serial device and that appears as /dev/tty.usbserial-XXXX.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
  • 1
    thank you, but in my case no new device appears. I clearly see it in the System Information but nothing changes in the /dev/ folder... – edelmaks Aug 02 '12 at 19:35
  • USB serial devices often appear as TTYs, but that gives you access to them as USB serial devices, not as raw USB devices. – abarnert Aug 03 '12 at 00:06
  • No Idea why this answer is downvoted, since the answer is correct, even if it misses the topic a bit. Up +1 again ;-) – ddlab Nov 13 '16 at 01:41
0

If your USB device has an FTDI chip internally, installing VCP drivers from FTDI might help.

Troy Weber
  • 897
  • 8
  • 8