4

I have installed Lubuntu 16.04 Xenial onto a tablet. By default, the screen is oriented sideways (like a Kindle or Nook), and the tablet doesn't have accelerometers to detect automatically when I rotate the device. This doesn't matter a great deal, as I will always be using the tablet as a 'monitor,' that is, rotated 90° from its original (Kindle/Nook-style) orientation.

I wrote a script to perform the rotation at login, but for some reason, it is performing the rotation of the display screen, but not the touchscreen input.

I thought it was perhaps because of the touchscreen input not being fully initialized when the xinput command is called, because I can execute the script manually after boot and it works just fine. I accounted for this in the script, so that the xinput command waits until the touchscreen input is initialized, but I still see the same results.

Here is the script:

#!/bin/bash
sleep 3
xrandr -o right &
while [ -z "xinput | grep -v 'Pen' | grep 'ELAN'" ]
do
    sleep 1
done
xinput set-prop 'ELAN22A6:00 04F3:22A6' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
xinput disable 'ASUS HID Device ASUS HID Device Touchpad'

Note: There are two devices with almost exactly the same name under the xinput list - the touchscreen input and a pen pointer (which won't be used). The device ELAN22A6:00 04F3:22A6 is the touchscreen input.

Also, this may or may not be relevant, but I'm running gnome-shell on top of Lubuntu, as well, which is also scripted to start at login (because I don't want it as the default desktop manager).

What am I missing here?

3

It looks like you are missing backticks. Try changing:

while [ -z "xinput | grep -v 'Pen' | grep 'ELAN'" ]

to

while [ -z "`xinput | grep -v 'Pen' | grep 'ELAN'`" ]
  • Thanks so much for the reply. Unfortunately, it doesn't appear that those made a difference in the resultant behavior. I had originally tried this code without the while loop, and when that didn't work, I added the loop because I thought the system needed to wait for the input to initialize first. – Dean Rusmor May 2 '17 at 22:27
  • 1
    Might be related to the manual start of gnome-shell that you mentioned in your question. If you disable that, does it work? Edit: You could also try check end of /var/log/syslog for any error output from the script and/or xinput, after login. – d99kris May 3 '17 at 0:25
  • Actually, yes, I believe you are correct - it does appear to be related to gnome-shell. However, there does not appear to be anything particularly incriminating in the syslog for either the script or xinput. So, when I turn off the script to call gnome-shell, everything works just fine - the touchscreen input orientation reliable changes as desired. The problem is that I need gnome-shell to run for our application. – Dean Rusmor May 3 '17 at 15:09
  • 1
    So generally I think it's a good idea to start the desired window manager using the standard method(s). But if you really need to start it this way, you could try to extend your script to wait for gnome-shell to have been started as well, by adding something like this: while [ -z "`pidof gnome-shell`" ]; do sleep 1; done on the line before your existing while-loop. Can't say confidently it will work, but it's probably worth a try. – d99kris May 3 '17 at 15:37
  • Thanks again for the reply. I did indeed try your suggestion, but unfortunately it was to no avail. I did more-or-less "prove" that it must be somehow related to gnome-shell, because my ultimate solution came to be a separate bash script, wherein I simply brute force the transformation to be applied, but I must first sleep for 5-10 seconds while gnome-shell loads. – Dean Rusmor May 11 '17 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.