XFree Local Multi-User HOWTO
Prev | Chapter 5. More on configuring input devices | Next

# 5.1. Finding the real devices

We will need this information later on, to be able to assign a given keyboard/mouse to a given X-server/Display.

To find the PHYS ID's (the addresses) or the name(quite oft it differs from the one labeled on the device) of your input devices you have to read the file `/proc/bus/input/devices`.

Here is what I have:

    [svetljo@svetljo How-To]# cat /proc/bus/input/devices
    I: Bus=0011 Vendor=0002 Product=0002 Version=0034
    N: Name="PS2++ Logitech Wheel Mouse"
    P: Phys=isa0060/serio1/input0
    H: Handlers=mouse0 ts0
    B: EV=7
    B: KEY=f0000 0 0 0 0 0 0 0 0
    B: REL=103

    I: Bus=0011 Vendor=0001 Product=0002 Version=ab02
    N: Name="AT Set 2 keyboard"
    P: Phys=isa0060/serio0/input0
    H: Handlers=kbd
    B: EV=120003
    B: KEY=4 2000000 8061f9 fbc9d621 efdfffdf ffefffff ffffffff fffffffe
    B: LED=7

    I: Bus=0003 Vendor=046d Product=c303 Version=0700
    N: Name="Logitech    USB Keyboard"
    P: Phys=usb-00:10.1-1.1/input0
    H: Handlers=kbd
    B: EV=120003
    B: KEY=10000 7f ffe00000 7ff ffbeffdf ffffffff ffffffff fffffffe
    B: LED=7

    I: Bus=0003 Vendor=046d Product=c303 Version=0700
    N: Name="Logitech    USB Keyboard"
    P: Phys=usb-00:10.1-1.1/input1
    H: Handlers=kbd
    B: EV=100003
    B: KEY=1078 1800d100 1e0000 0 0 0

    I: Bus=0003 Vendor=05fe Product=0011 Version=0000
    N: Name="Cypress Sem. PS2/USB Browser Combo Mouse"
    P: Phys=usb-00:10.1-1.2/input0
    H: Handlers=mouse1 ts1
    B: EV=7
    B: KEY=1f0000 0 0 0 0 0 0 0 0
    B: REL=103

| Note

- `/proc/bus/input/devices` will provide the needed information for all devices except USB multimedia/office keyboards.

- For such USB multimedia/office keyboards you will have to gather additional information, for example with the help of lsusb.

- Under Ruby-2.6 for usb devices it will look like "usb-0000:00:10.x" not "usb-00:10.x"

- First we have to find the address of the USB keyboard:

      [root@svetljo How-To]# lsusb
      Bus 004 Device 001: ID 0000:0000
      Bus 003 Device 001: ID 0000:0000
      Bus 003 Device 002: ID 0409:55ab NEC Corp. Hub [iMac kbd]
      Bus 003 Device 003: ID 046d:c303 Logitech, Inc.
      Bus 003 Device 004: ID 05fe:0011 Chic Technology Corp. Browser Mouse
      Bus 002 Device 001: ID 0000:0000
      Bus 001 Device 001: ID 0000:0000

  Here, my USB Logitech keyboard is Device 003 on Bus 003.

- Now we run lsusb with arguments `-v -s [your USB keyboard device id in form Bus:Device]`, in my case, lsusb -v -s 003:003.

      ........
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         3 Human Interface Devices
            bInterfaceSubClass      1 Boot Interface Subclass
            bInterfaceProtocol      1 Keyboard
            iInterface              0
      ........

          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         3 Human Interface Devices
            bInterfaceSubClass      0 No Subclass
            bInterfaceProtocol      0 None
            iInterface              0
      ........

So my USB keyboard has two interfaces (see bInterfaceNumber); the first one is the real keyboard (bInterfaceProtocol 1 Keyboard), the second (bInterfaceProtocol 0 None) - the additional keys. Hence the real USB keyboard is:

    .....
    N: Name="Logitech    USB Keyboard"
    P: Phys=usb-00:10.1-1.1/input0
    H: Handlers=kbd
    .....

The "P: Phys=" field (the physical descriptor/address) consorts of:

1. Bus type: "usb"

2. PCI function of the USB controller: "00:10.1 " ( for Ruby-2.6 "0000:00:10.1")

3. USB device id: "1.1"

4. The string: "/input"

5. Interface number: "0"

Prev | Home | Next
More on configuring input devices | Up | Using hotplug with `input.agent` and `input.rc`