How to get xinput to identify an inputer device by name with excess whitespace?

5,158

The hexdump shows there's only spaces (20) in the name, but there are also spaces after the second part. So you need to do something like

xinput map-to-output "Weida Hi-Tech                CoolTouchR System           " DP-4

(I hope I counted correctly; if not, please verify the number of spaces yourself).

Share:
5,158

Related videos on Youtube

Bob Liberatore
Author by

Bob Liberatore

I specialize in outside-the-box apps that bend the Android API to its limits to create unique user experiences. I have 5 years of experience working full-time on a math education Android app that has been awarded a SBIR grant from the National Science Foundation.

Updated on September 18, 2022

Comments

  • Bob Liberatore
    Bob Liberatore over 1 year

    I have a secondary monitor that is a touch screen. I can successfully map the input to the correct screen using xinput map-to-output 12 DP-4.

    However, the ID number for the input device is not consistent between boots. The way to fix this is to use the name of the device. However, I have a weird issue:

    user@DESKTOP-VALMMNL:/etc/init.d$ xinput
    ⎡ Virtual core pointer                      id=2    [master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
    ⎜   ↳ USB Optical Mouse                         id=9    [slave  pointer  (2)]
    ⎜   ↳ Weida Hi-Tech                CoolTouchR System            id=12   [slave  pointer  (2)]`
    

    As you can see, the input device I need to map (id=12) has a lot of whitespace in its name. Copying and pasting it as displayed (i.e. xinput map-to-output "Weida Hi-Tech CoolTouchR System" DP-4) does not work. hexdump of the names:

    enter image description here

    • dirkt
      dirkt over 7 years
      Maybe there's a tab or end-of-line char in the name? What do you see if you do xinput list --name-only | hexdump -C (you may need to install hexdump)?
    • Bob Liberatore
      Bob Liberatore over 7 years
      @dirkt I did try adding in escaped characters, including tabs, but xinput only seemed to recognize escaped spaces. Putting in \t does not result in a tab. I added a screenshot of the output from the command you suggested.
    • Toby Speight
      Toby Speight over 7 years
      Did you include all the trailing spaces in your command? Try xinput --list 'Weida Hi-Tech CoolTouchR System ', since that output shows 11 spaces at the end of the name. (note that not all the spaces are shown here in the comment - you'll probably have to type them - or device=`xinput list --name-only | grep -m1 Weida`\).