2

I've been trying to view which devices are connected to my USB ports through terminal in El Capitan, in particular a USB mouse. I've read online that I can ls /dev/tty.* to view all connected devices. But each time I try this before and after connecting a device, the output does not change.

I've also tried ls /dev and do not see a change in the output.

I've also tried ls /dev >> before.txt, then, after plugging in a device (like a mouse), ls /dev >> after.txt', then vimdiff before.txt after.txt. And I still do not see any new devices.

Is this the correct location to be looking in for devices? (namely /dev)

If not, where should I be looking?

Note, there is not a location for /dev/input on my machine. Also, I'm doing this because I would like to practice reading the bits from a serial bus and I need access to the bits incoming from the USB port.

  • Are you looking for a USB serial modem? Can you confirm that the modem is properly connected and drivers loaded? – agentroadkill Dec 28 '15 at 2:39
  • I should be more clear. I am solely looking for the connection of a USB mouse. I am just wanting to practice reading data incoming from a serial port (which I thought is a USB port), and to do that I need to know where it is located to read incoming bits. It doesn't need to be a mouse; a mouse is the only device I currently have that connects through a USB. I am trying to read that data in both C++ and Python, but I need to know where the device is located to get access to the bits, at my current level of understanding. – K. Shores Dec 28 '15 at 2:49
  • By convention, a 'serial port' generally refers to an RS-232 compatible port, though you are technically correct many other communications standards are serial in nature. If you actually want to use the mouse, any modern language will have facilities to support this via the OS' API. You can look here for Apple's documentation for Cocoa, its C/objective C wrapper, or poke around with Python. – agentroadkill Dec 28 '15 at 3:04
  • I would need to do more research to know where the mouse actually is, but a modern operating system will give this to you, almost for free. This is both safer and ensures operability across applications. – agentroadkill Dec 28 '15 at 3:05
-1

For any regular USB device, use:

diskutil list

This brings up the disk utility command line interface's "list" tool, which provides you with information on internal and connected disks, be it through USB, SATA or PCIe. It's much simpler than looking through /dev (which includes ttys and a lot of other stuff), and gives you much more information like capacity, partition tabling and the S.M.A.R.T. status (if supported) of your drive.

If you'd like to look through /dev though, try

ls /dev | grep disk

This will show only the entries with "disk" in them (disks and connected devices in OS X are mounted as /dev/disk[number]).

-1

This answer will attempt to cater to your intentions, if I've misinterpreted, feel free to comment and let me know.

Apple does a fairly good job of allowing developers access to hardware through the OS, the sort of direct reading you appear to want to do bypasses the hardware abstraction layer, and so is discouraged and very rarely found today outside of DOS.

Further, while a USB mouse uses a serial communication method (Universal Serial Bus), it is not an RS-232 or COM port which is commonly referred to as a serial port.

If you want to learn to take advantage of the mouse when writing programs or scripts on your Mac, take a look at Apple's Developer Guide and try out Python, though at that point we're into software development, so you'll want to check out StackOverflow.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .