Disable the external keyboard from a script

5,558

Solution 1

Using a script

One method would be via a script that gets invoked as a script from UDEV. The method I would take, I fleshed out in this U&L Q&A titled: How to disable keyboard?.

There are pretty good directions on enabling/disabling a keyboard here as well, titled: Disable / enable keyboard and mouse in Linux.

Example

You can list the devices with this command.

$ xinput --list
"Virtual core pointer"  id=0    [XPointer]
"Virtual core keyboard" id=1    [XKeyboard]
"Keyboard2"     id=2    [XExtensionKeyboard]
"Mouse2"        id=3    [XExtensionKeyboard]

And disable the keyboard with this:

$ xinput set-int-prop 2 "Device Enabled" 8 0

And enable it with this one:

$ xinput set-int-prop 2 "Device Enabled" 8 1

So you could put the above commands into scripts that UDEV could call them.

NOTE: This only works for disabling the keyboard through X. So if you're on a system that isn't running X this won't work.

Using UDEV

I think you might be able to adapt one of these rules to disable a USB based keyboard using a rule similar to this one:

BUS=="usb", KERNEL=="hdb", OPTIONS+="ignore_device"

You'd need to determine the identifications for your external keyboard. I believe all the information you'd need to craft one of these rules is included in the output that you included in your question.

Solution 2

Well, you can disable any USB device, in this case, keyboard. Navigate to directory /sys/bus/usb/drivers/usbhid

It will list all the USB HID device's number. For your keyboard, find out correct number and execute the command:

echo -n 2-1.4:1.0 > unbind

It will unbind (disable) the underlying USB hardware To enable it again, execute

echo -n 2-1.4:1.0 > bind

Here, issue is to find out correct number. But that can be solved by knowing the vendor and product id

Share:
5,558

Related videos on Youtube

ibasaran
Author by

ibasaran

Updated on September 18, 2022

Comments

  • ibasaran
    ibasaran over 1 year

    I have a udev rule for my external keyboard. I can catch events, and by running a script I can also reach udev env variables. Can I disable keyboard with udev? Or must I use a script to disable the keyboard in another way.

    There is a one way to disable keyboard with script to running xinput but it wants an "id". How can I get the id information for xinput from udev? or is there another effective way?

    Whole trace when I monitor udev for keyboard:

    KERNEL[2563.037091] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2 (usb)
    ACTION=add
    BUSNUM=002
    DEVICE=/proc/bus/usb/002/003
    DEVNAME=bus/usb/002/003
    DEVNUM=003
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2
    DEVTYPE=usb_device
    MAJOR=189
    MINOR=130
    PRODUCT=1c4f/2/110
    SEQNUM=1538
    SUBSYSTEM=usb
    TYPE=0/0/0
    UDEV_LOG=3
    
    KERNEL[2563.037837] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0 (usb)
    ACTION=add
    DEVICE=/proc/bus/usb/002/003
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0
    DEVTYPE=usb_interface
    INTERFACE=3/1/1
    MODALIAS=usb:v1C4Fp0002d0110dc00dsc00dp00ic03isc01ip01
    PRODUCT=1c4f/2/110
    SEQNUM=1539
    SUBSYSTEM=usb
    TYPE=0/0/0
    UDEV_LOG=3
    
    KERNEL[2563.038023] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005 (hid)
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005
    HID_ID=0003:00001C4F:00000002
    HID_NAME=SIGMACH1P USB Keykoard
    HID_PHYS=usb-0000:09:00.0-2/input0
    MODALIAS=hid:b0003v00001C4Fp00000002
    SEQNUM=1540
    SUBSYSTEM=hid
    UDEV_LOG=3
    
    KERNEL[2563.040754] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17 (input)
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17
    EV=120013
    KEY=1000000000007 ff800000000007ff febeffdff3cfffff fffffffffffffffe
    LED=7
    MODALIAS=input:b0003v1C4Fp0002e0110-e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw
    MSC=10
    NAME="SIGMACH1P USB Keykoard"
    PHYS="usb-0000:09:00.0-2/input0"
    PRODUCT=3/1c4f/2/110
    PROP=0
    SEQNUM=1541
    SUBSYSTEM=input
    UDEV_LOG=3
    UNIQ=""
    
    KERNEL[2563.040970] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17/event6 (input)
    ACTION=add
    DEVNAME=input/event6
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17/event6
    MAJOR=13
    MINOR=70
    SEQNUM=1542
    SUBSYSTEM=input
    UDEV_LOG=3
    
    KERNEL[2563.041090] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005/hidraw/hidraw2 (hidraw)
    ACTION=add
    DEVNAME=hidraw2
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005/hidraw/hidraw2
    MAJOR=252
    MINOR=2
    SEQNUM=1543
    SUBSYSTEM=hidraw
    UDEV_LOG=3
    
    KERNEL[2563.041168] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1 (usb)
    ACTION=add
    DEVICE=/proc/bus/usb/002/003
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1
    DEVTYPE=usb_interface
    INTERFACE=3/0/0
    MODALIAS=usb:v1C4Fp0002d0110dc00dsc00dp00ic03isc00ip00
    PRODUCT=1c4f/2/110
    SEQNUM=1544
    SUBSYSTEM=usb
    TYPE=0/0/0
    UDEV_LOG=3
    
    KERNEL[2563.041309] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006 (hid)
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006
    HID_ID=0003:00001C4F:00000002
    HID_NAME=SIGMACH1P USB Keykoard
    HID_PHYS=usb-0000:09:00.0-2/input1
    MODALIAS=hid:b0003v00001C4Fp00000002
    SEQNUM=1545
    SUBSYSTEM=hid
    UDEV_LOG=3
    
    KERNEL[2563.044144] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18 (input)
    ABS=100000000
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18
    EV=1f
    KEY=4837fff072ff32d bf54444600000000 1 20c100b17c000 267bfad941dfed 9e168000004400 10000002
    MODALIAS=input:b0003v1C4Fp0002e0110-e0,1,2,3,4,k71,72,73,74,77,80,82,83,85,86,87,88,89,8A,8B,8C,8E,8F,90,96,98,9B,9C,9E,9F,A1,A3,A4,A5,A6,A7,A8,A9,AB,AC,AD,AE,B1,B2,B5,CE,CF,D0,D1,D2,D4,D8,D9,DB,E4,EA,EB,F1,100,161,162,166,16A,16E,172,174,176,178,179,17A,17B,17C,17D,17F,180,182,183,185,188,189,18C,18D,18E,18F,190,191,192,193,195,198,199,19A,1A0,1A1,1A2,1A3,1A4,1A5,1A6,1A7,1A8,1A9,1AA,1AB,1AC,1AD,1AE,1B0,1B1,1B7,1BA,r6,a20,m4,lsfw
    MSC=10
    NAME="SIGMACH1P USB Keykoard"
    PHYS="usb-0000:09:00.0-2/input1"
    PRODUCT=3/1c4f/2/110
    PROP=0
    REL=40
    SEQNUM=1546
    SUBSYSTEM=input
    UDEV_LOG=3
    UNIQ=""
    
    KERNEL[2563.044365] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18/event7 (input)
    ACTION=add
    DEVNAME=input/event7
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18/event7
    MAJOR=13
    MINOR=71
    SEQNUM=1547
    SUBSYSTEM=input
    UDEV_LOG=3
    
    KERNEL[2563.044560] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006/hidraw/hidraw3 (hidraw)
    ACTION=add
    DEVNAME=hidraw3
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006/hidraw/hidraw3
    MAJOR=252
    MINOR=3
    SEQNUM=1548
    SUBSYSTEM=hidraw
    UDEV_LOG=3
    
    UDEV  [2563.066401] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2 (usb)
    ACTION=add
    BUSNUM=002
    DEVICE=/proc/bus/usb/002/003
    DEVNAME=/dev/bus/usb/002/003
    DEVNUM=003
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2
    DEVTYPE=usb_device
    ID_BUS=usb
    ID_MODEL=USB_Keykoard
    ID_MODEL_ENC=USB\x20Keykoard
    ID_MODEL_ID=0002
    ID_REVISION=0110
    ID_SERIAL=SIGMACH1P_USB_Keykoard
    ID_USB_INTERFACES=:030101:030000:
    ID_VENDOR=SIGMACH1P
    ID_VENDOR_ENC=SIGMACH1P
    ID_VENDOR_ID=1c4f
    MAJOR=189
    MINOR=130
    PRODUCT=1c4f/2/110
    SEQNUM=1538
    SUBSYSTEM=usb
    TYPE=0/0/0
    UDEV_LOG=3
    USEC_INITIALIZED=2563048257
    
    UDEV  [2563.071837] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1 (usb)
    ACTION=add
    DEVICE=/proc/bus/usb/002/003
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1
    DEVTYPE=usb_interface
    INTERFACE=3/0/0
    MODALIAS=usb:v1C4Fp0002d0110dc00dsc00dp00ic03isc00ip00
    PRODUCT=1c4f/2/110
    SEQNUM=1544
    SUBSYSTEM=usb
    TYPE=0/0/0
    UDEV_LOG=3
    USEC_INITIALIZED=2563068334
    
    UDEV  [2563.072377] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0 (usb)
    ACTION=add
    DEVICE=/proc/bus/usb/002/003
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0
    DEVTYPE=usb_interface
    INTERFACE=3/1/1
    MODALIAS=usb:v1C4Fp0002d0110dc00dsc00dp00ic03isc01ip01
    PRODUCT=1c4f/2/110
    SEQNUM=1539
    SUBSYSTEM=usb
    TYPE=0/0/0
    UDEV_LOG=3
    USEC_INITIALIZED=2563068933
    
    UDEV  [2563.079363] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005 (hid)
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005
    HID_ID=0003:00001C4F:00000002
    HID_NAME=SIGMACH1P USB Keykoard
    HID_PHYS=usb-0000:09:00.0-2/input0
    MODALIAS=hid:b0003v00001C4Fp00000002
    SEQNUM=1540
    SUBSYSTEM=hid
    UDEV_LOG=3
    USEC_INITIALIZED=2563074770
    
    UDEV  [2563.080760] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005/hidraw/hidraw2 (hidraw)
    ACTION=add
    DEVNAME=/dev/hidraw2
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/0003:1C4F:0002.0005/hidraw/hidraw2
    MAJOR=252
    MINOR=2
    SEQNUM=1543
    SUBSYSTEM=hidraw
    UDEV_LOG=3
    USEC_INITIALIZED=2563080427
    
    UDEV  [2563.084307] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006 (hid)
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006
    HID_ID=0003:00001C4F:00000002
    HID_NAME=SIGMACH1P USB Keykoard
    HID_PHYS=usb-0000:09:00.0-2/input1
    MODALIAS=hid:b0003v00001C4Fp00000002
    SEQNUM=1545
    SUBSYSTEM=hid
    UDEV_LOG=3
    USEC_INITIALIZED=2563073436
    
    UDEV  [2563.085738] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006/hidraw/hidraw3 (hidraw)
    ACTION=add
    DEVNAME=/dev/hidraw3
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/0003:1C4F:0002.0006/hidraw/hidraw3
    MAJOR=252
    MINOR=3
    SEQNUM=1548
    SUBSYSTEM=hidraw
    UDEV_LOG=3
    USEC_INITIALIZED=2563085486
    
    UDEV  [2563.238882] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18 (input)
    ABS=100000000
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18
    EV=1f
    ID_BUS=usb
    ID_INPUT=1
    ID_INPUT_KEY=1
    ID_MODEL=USB_Keykoard
    ID_MODEL_ENC=USB\x20Keykoard
    ID_MODEL_ID=0002
    ID_PATH=pci-0000:09:00.0-usb-0:2:1.1
    ID_PATH_TAG=pci-0000_09_00_0-usb-0_2_1_1
    ID_REVISION=0110
    ID_SERIAL=SIGMACH1P_USB_Keykoard
    ID_TYPE=hid
    ID_USB_DRIVER=usbhid
    ID_USB_INTERFACES=:030101:030000:
    ID_USB_INTERFACE_NUM=01
    ID_VENDOR=SIGMACH1P
    ID_VENDOR_ENC=SIGMACH1P
    ID_VENDOR_ID=1c4f
    KEY=4837fff072ff32d bf54444600000000 1 20c100b17c000 267bfad941dfed 9e168000004400 10000002
    MODALIAS=input:b0003v1C4Fp0002e0110-e0,1,2,3,4,k71,72,73,74,77,80,82,83,85,86,87,88,89,8A,8B,8C,8E,8F,90,96,98,9B,9C,9E,9F,A1,A3,A4,A5,A6,A7,A8,A9,AB,AC,AD,AE,B1,B2,B5,CE,CF,D0,D1,D2,D4,D8,D9,DB,E4,EA,EB,F1,100,161,162,166,16A,16E,172,174,176,178,179,17A,17B,17C,17D,17F,180,182,183,185,188,189,18C,18D,18E,18F,190,191,192,193,195,198,199,19A,1A0,1A1,1A2,1A3,1A4,1A5,1A6,1A7,1A8,1A9,1AA,1AB,1AC,1AD,1AE,1B0,1B1,1B7,1BA,r6,a20,m4,lsfw
    MSC=10
    NAME="SIGMACH1P USB Keykoard"
    PHYS="usb-0000:09:00.0-2/input1"
    PRODUCT=3/1c4f/2/110
    PROP=0
    REL=40
    SEQNUM=1546
    SUBSYSTEM=input
    UDEV_LOG=3
    UNIQ=""
    USEC_INITIALIZED=2563044149
    
    UDEV  [2563.391000] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17 (input)
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17
    EV=120013
    ID_BUS=usb
    ID_INPUT=1
    ID_INPUT_KEY=1
    ID_INPUT_KEYBOARD=1
    ID_MODEL=USB_Keykoard
    ID_MODEL_ENC=USB\x20Keykoard
    ID_MODEL_ID=0002
    ID_PATH=pci-0000:09:00.0-usb-0:2:1.0
    ID_PATH_TAG=pci-0000_09_00_0-usb-0_2_1_0
    ID_REVISION=0110
    ID_SERIAL=SIGMACH1P_USB_Keykoard
    ID_TYPE=hid
    ID_USB_DRIVER=usbhid
    ID_USB_INTERFACES=:030101:030000:
    ID_USB_INTERFACE_NUM=00
    ID_VENDOR=SIGMACH1P
    ID_VENDOR_ENC=SIGMACH1P
    ID_VENDOR_ID=1c4f
    KEY=1000000000007 ff800000000007ff febeffdff3cfffff fffffffffffffffe
    LED=7
    MODALIAS=input:b0003v1C4Fp0002e0110-e0,1,4,11,14,k71,72,73,74,75,77,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86,87,88,89,8A,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,F0,ram4,l0,1,2,sfw
    MSC=10
    NAME="SIGMACH1P USB Keykoard"
    PHYS="usb-0000:09:00.0-2/input0"
    PRODUCT=3/1c4f/2/110
    PROP=0
    SEQNUM=1541
    SUBSYSTEM=input
    UDEV_LOG=3
    UNIQ=""
    USEC_INITIALIZED=2563040766
    
    UDEV  [2563.410790] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18/event7 (input)
    ACTION=add
    BACKSPACE=guess
    DEVLINKS=/dev/input/by-id/usb-SIGMACH1P_USB_Keykoard-event-if01 /dev/input/by-path/pci-0000:09:00.0-usb-0:2:1.1-event
    DEVNAME=/dev/input/event7
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.1/input/input18/event7
    ID_BUS=usb
    ID_INPUT=1
    ID_INPUT_KEY=1
    ID_MODEL=USB_Keykoard
    ID_MODEL_ENC=USB\x20Keykoard
    ID_MODEL_ID=0002
    ID_PATH=pci-0000:09:00.0-usb-0:2:1.1
    ID_PATH_TAG=pci-0000_09_00_0-usb-0_2_1_1
    ID_REVISION=0110
    ID_SERIAL=SIGMACH1P_USB_Keykoard
    ID_TYPE=hid
    ID_USB_DRIVER=usbhid
    ID_USB_INTERFACES=:030101:030000:
    ID_USB_INTERFACE_NUM=01
    ID_VENDOR=SIGMACH1P
    ID_VENDOR_ENC=SIGMACH1P
    ID_VENDOR_ID=1c4f
    MAJOR=13
    MINOR=71
    SEQNUM=1547
    SUBSYSTEM=input
    UDEV_LOG=3
    USEC_INITIALIZED=2563239989
    XKBLAYOUT=tr
    XKBMODEL=pc105
    XKBOPTIONS=lv3:ralt_switch
    
    UDEV  [2563.576817] add      /devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17/event6 (input)
    ACTION=add
    BACKSPACE=guess
    DEVLINKS=/dev/input/by-id/usb-SIGMACH1P_USB_Keykoard-event-kbd /dev/input/by-path/pci-0000:09:00.0-usb-0:2:1.0-event-kbd
    DEVNAME=/dev/input/event6
    DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:09:00.0/usb2/2-2/2-2:1.0/input/input17/event6
    ID_BUS=usb
    ID_INPUT=1
    ID_INPUT_KEY=1
    ID_INPUT_KEYBOARD=1
    ID_MODEL=USB_Keykoard
    ID_MODEL_ENC=USB\x20Keykoard
    ID_MODEL_ID=0002
    ID_PATH=pci-0000:09:00.0-usb-0:2:1.0
    ID_PATH_TAG=pci-0000_09_00_0-usb-0_2_1_0
    ID_REVISION=0110
    ID_SERIAL=SIGMACH1P_USB_Keykoard
    ID_TYPE=hid
    ID_USB_DRIVER=usbhid
    ID_USB_INTERFACES=:030101:030000:
    ID_USB_INTERFACE_NUM=00
    ID_VENDOR=SIGMACH1P
    ID_VENDOR_ENC=SIGMACH1P
    ID_VENDOR_ID=1c4f
    MAJOR=13
    MINOR=70
    SEQNUM=1542
    SUBSYSTEM=input
    UDEV_LOG=3
    USEC_INITIALIZED=2563392826
    XKBLAYOUT=tr
    XKBMODEL=pc105
    XKBOPTIONS=lv3:ralt_switch
    

    EDIT FOR SHW POST

    System info

    Distributor ID: Debian Description: Debian GNU/Linux 7.2 (wheezy) Release: 7.2 Codename: wheezy

    udev version 175

    Unbind keyboard syslog result

    Jan 16 13:47:50  acpid: input device has been disconnected, fd 13
    Jan 16 13:47:51  kernel: [  694.216123] usb 1-1.3: USB disconnect, device number 17
    Jan 16 13:47:51  acpid: input device has been disconnected, fd 15
    Jan 16 13:47:51  kernel: [  694.507848] usb 1-1.3: new low-speed USB device number 18 using ehci_hcd
    Jan 16 13:47:51  kernel: [  694.606225] usb 1-1.3: New USB device found, idVendor=1c4f, idProduct=0002
    Jan 16 13:47:51  kernel: [  694.606235] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Jan 16 13:47:51  kernel: [  694.606242] usb 1-1.3: Product: USB Keykoard
    Jan 16 13:47:51  kernel: [  694.606246] usb 1-1.3: Manufacturer: SIGMACH1P
    Jan 16 13:47:51  kernel: [  694.609792] input: SIGMACH1P USB Keykoard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.0/input/input57
    Jan 16 13:47:51  kernel: [  694.610190] generic-usb 0003:1C4F:0002.0027: input,hidraw2: USB HID v1.10 Keyboard [SIGMACH1P USB Keykoard] on usb-0000:00:1a.0-1.3/input0
    Jan 16 13:47:51  kernel: [  694.613248] input: SIGMACH1P USB Keykoard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.1/input/input58
    Jan 16 13:47:51  kernel: [  694.613646] generic-usb 0003:1C4F:0002.0028: input,hidraw3: USB HID v1.10 Device [SIGMACH1P USB Keykoard] on usb-0000:00:1a.0-1.3/input1
    Jan 16 13:47:51  mtp-probe: checking bus 1, device 18: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3"
    Jan 16 13:47:51  mtp-probe: bus: 1, device: 18 was not an MTP device
    
    • Admin
      Admin over 10 years
      unfortunately customer requirement. they want to manage keyboards.
    • Admin
      Admin over 10 years
      They want to be able to manually switch between connected keyboards? How would you do this through udev? It only detects when devices are plugged in/out. When exactly do you want the device to be disabled? Do you simply want it to be always ignored?
    • Admin
      Admin over 10 years
      they want to disable or enable keyboard dynamically. i am using udev for detect the device. i can get all information of device when plug or unplug via udev. i am searching alternative way to disable/enable keyboard dynamically. obviously, scenario - when user plug a externall keyboard i am looking user permission and if he has not permission i am disabling the keyboard if he has enabling.
  • ibasaran
    ibasaran over 10 years
    thanks for your reply slm. i know we can disable keyboard via xinput but how can i get id information from udev ?
  • slm
    slm over 10 years
    @ibasaran - you have to go through the output you posted and determine which device is your keyboard. You can then make a corresponding .rules file and place it in /etc/udev/rules.d/. The key info is the rule needs to have OPTIONS+="ignore_device" in it so that UDEV will effectively disable the keyboard device.
  • ibasaran
    ibasaran over 10 years
    sorry for late reply, ignore_device not working anymore. lists.ubuntu.com/archives/kubuntu-users/2010-November/…
  • slm
    slm over 10 years
    @ibasaran - can you elaborate please? Not working how?
  • ibasaran
    ibasaran over 10 years
    lwn.net/Articles/364728 No longer exists "ignore device"
  • ibasaran
    ibasaran over 10 years
    Thnks for your replay SHW. Right, this way disabling my keyboard. But one problem, i unbind my keyboard after few seconds it authomatically binds again.
  • SHW
    SHW over 10 years
    IIRC, only UDEV can bind the hardware. By any chance, are you reloading the rules OR restarting the UDEVD ?
  • ibasaran
    ibasaran over 10 years
    Right when i unbind device, udev binding again but i am not reloadig rules again. it is happing automatically.
  • ibasaran
    ibasaran over 10 years
    also i unbind a storage. storage not binding again but keyboard binding again.
  • SHW
    SHW over 10 years
    I tried at my (custom) distro. It works as expected for USB keyboard. Udev version 197 is here. Can you post dmesg output and/or /var/log/syslog file content ?
  • ibasaran
    ibasaran over 10 years
    edited orginal post syslog output.
  • SHW
    SHW over 10 years
    Just for cross-checking UDEV version, can you exercise this on new LIVE OS ?
  • ibasaran
    ibasaran over 10 years
    also i checked ubuntu 12.04 udev version. it is 175. i will try to upgrade udev for testing.
  • Svartalf
    Svartalf over 9 years
    The "rebind again" issue is that udev sees the keyboard and re-binds it. (Makes for a nice reset for my little project) It's a feature/misfeature of how it sees input devices.