Off-Topic > Off-Topic - Tiny Core Lounge

how to automatically get xinput id of keyboard?

<< < (2/5) > >>

Rich:
Hi GNUser
This one picks out the line for the actual keyboard:

--- Code: ---tc@E310:~$ xinput --list | grep -i keyboard | grep -iv "Virtual core" | grep -iv Button
    â³ DELL DELL USB Keyboard                          id=9    [slave  keyboard (3)]
tc@E310:~$
--- End code ---
And it's backward compatible with TC4:

--- Code: ---tc@box:~$ xinput --list | grep -i keyboard | grep -iv "Virtual core" | grep -iv Button
    â³ Keyboard0                                       id=6    [slave  keyboard (3)]
tc@box:~$
--- End code ---

curaga:
Regarding the system language, you can run "LANG=C xinput ..." to get English output.

GNUser:
Thank you both. I think we're getting warmer. Does this work on all your test systems?


--- Code: ---LANG=C xinput --list | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
--- End code ---

Rich:
Hi GNUser

--- Quote from: GNUser on September 14, 2019, 07:16:00 AM --- ... Does this work on all your test systems? ...
--- End quote ---
Yes it does. TC10:

--- Code: ---tc@E310:~$ LANG=C xinput --list | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
9
tc@E310:~$
--- End code ---
TC4:

--- Code: ---tc@box:~$ LANG=C xinput --list | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
6
tc@box:~$
--- End code ---

GNUser:
Darn, on my wife's Sony Vaio I get some stray hits:


--- Code: ---eileen@vaio:~$ LANG=C xinput --list | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
7
10
12
14
eileen@vaio:~$ LANG=C xinput --list | grep -i keyboard | egrep -iv 'virtual|video|button|bus'
    ↳ Sony Vaio Keys                          id=7 [slave  keyboard (3)]
    ↳ USB 2.0 Camera: USB 2.0 Camera          id=10 [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            id=12 [slave  keyboard (3)]
    ↳ Sony Vaio Jogdial                        id=14 [slave  keyboard (3)]

--- End code ---

The correct id on her system is 12. There must be a universal solution, but we're not there yet.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version