Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Which device file is which in /dev?

    I understand that files in /dev are device files that represent devices on the computer. But which is which? In particular, how do I find out which device files in my /dev folder represent the following?

    My mouse?
    My microphone?
    My webcam?
    My keyboard?

    I tried to look at the Linux Device List (sorry I'm not allowed to post URLs on this yet) but that was really confusing (as most Linux documentation seem to be in my humble (in)experience). Then I looked at /dev/input directory on my computer, which had files mouse0, ..., mouse3, mice, and event0, ..., event9. I don't know what they mean, and I don't know which one represents my mouse.

    "Why do you want to know that?" I hear you ask. Well, the reason may be as silly as my current question. I just want to try to open it and read raw data from it and see what happens, say in Python. What I really want to do is to be able to read data from a device and make a program do things based on the data from the device. Is that a silly thing to do? I'm quite ignorant about computers.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Harrow, UK
    If you have a ps2 mouse, its device will be /dev/psaux. Usb mice use /dev/input/mice. The keyboard does not have a device to itself; it forms part of whatever terminal device you are using. However keyboard events are reported through one of the event devices. You can see which one by listing /dev/input/by-path using ls -l.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Thank you Hazel, that was very helpful.

    But may I ask how you knew all this? Is it just by sheer experience and experiment? Is there a tutorial on this that you or anyone else could recommend?

    I was thinking that there must be a Linux command or Ubuntu utility that tells you which device file in /dev points to which device. What if I want to know which device file points to my microphone for example? Is there such a command or utility?

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts