How To Flip 10.8" Touchscreen 180 degrees

Flip 10.8" Touchscreen 180 degrees

CAUTION: This is an unsupported procedure. Onefinity has explicitly stated this in post #2 of this thread as seen here.

If you still choose to continue you should consider creating a backup of the Onefinity Micro SD card using this How-to


Follow these steps to flip the Onefinity 10.8" touchscreen 180 degrees so the cables exit from the left side of the screen.

Things you need to type will follow the word Type: and be in this font
You do not type the word Type:
Special keys are denoted as follows:
<ctrl> is a modifier key, usually with the label “ctrl” on the key
<alt> is a modifier key, usually with the label “alt” on the key
<Enter> is the Enter key on your keyboard
In the case of modifier keys like <ctrl> and <alt>, they are used in conjunction with another key.
For example
Type: <ctrl>c
means you hold down the control key and press the c key before releasing.

The sudo command is used in many of the steps below. This command allows a permitted user such as our “pi” user to perform commands as the superuser. Be very cautious with this command. Things can get really screwed up if used improperly.

Steps 2 and 3 of the procedure below use the method of connecting a USB keyboard to the controller and getting into terminal mode directly on the controller’s Raspberry Pi. If you are familiar with the SSH method of accessing the Raspberry Pi remotely you can connect via SSH if you so desire in place of steps 2 and 3.

  1. Turn on your machine

  2. Connect a USB keyboard to a free USB port on the back of the Onefinity controller.

  3. Type: <ctrl-t> <ctrl-c>
    This places you in terminal mode which consists of a black screen with pi@onefinity:~ $ in blue, white, and green postitioned in the upper left corner. This is the prompt where you will type commands.

  4. Type: sudo mount -o remount,rw /boot<Enter>
    This command makes the /boot partition of the Raspberry Pi writable so we can make our changes. The pi@onefinity:~ $ prompt will appear on the next line down awaiting another command each time this and the other commands below complete.

  5. Type: sudo cp -ai /boot/config.txt /boot/config.txt.orig<Enter>
    This command makes a backup copy of the file we will be editing in case it is necessary to fall back.

  6. Type: sudo nano /boot/config.txt<Enter>
    This command places you in the nano editor and displays the contents of the file.
    Extreme caution should be exercised here as any errant key presses will alter the file and not in a good way.
    The image below shows what the screen should look like. The bottom two rows show some of the keystroke commands used in the nano editor. The ^ symbol denotes you press and hold the <ctrl> key followed by the key to its right and the M- combo denotes you press and hold the <alt> key followed by the key to its right. In addition, the arrow keys on the keyboard move the cursor around in the file.

  7. Type: <alt>/
    This keystroke combination will move the cursor to the bottom of the file. This can also be accomplished by using the down arrow key.

  8. Type: display_rotate=2<Enter>
    This entry tells the display driver to rotate the screen 180 degrees.

  9. Type: <ctrl>x
    This keystroke combination is the command to exit the nano editor. The editor will prompt you at the bottom left of the screen “Save modified buffer?”

  10. Type: y<Enter>
    Pressing y will bring up a second prompt asking for the file name but it defaults to the original file name. By pressing <Enter> right after pressing y we are accepting the original file name.

  11. Type: diff /boot/config.txt /boot/config.txt.orig<Enter>
    Note that sudo is not needed for this command as the the user pi has read permissions on these files.
    This command will display the differences between the file we just modified and the copy of the original file we made as a sanity check. The expected outcome is 2 lines. The first line is line numbers of the difference and can be safely ignored if it doesn’t match exactly what follows below:

     71d70
     < display_rotate=2
  1. Verify there are only 2 lines and line 2 displays as above. If both of these can be verified, skip to step 15.
  2. If verification in step 12 failed, then
    a. Type: sudo cp -ai /boot/config.txt.orig /boot/config.txt<Enter>
    This command will restore the original file while keeping our backup of the original intact.
    b. Go back and perform steps 6 through 12. We need to go back and edit the file once again.
  3. else if verification in step 12 succeeded, then continue:
  4. Type: sudo mount -o remount,ro /boot<Enter>
    Perform this command ONLY after verification has PASSED in step 12.
    This command makes the /boot partition of the Raspberry Pi read only once again.
  5. Type: cd /usr/share/X11/xorg.conf.d<Enter>
    Note the prompt will change to pi@onefinity:/usr/share/X11/xorg.conf.d $
    This command changes to a directory where our second and final edit is needed. This edit flips the touchscreen interface 180 degrees.
    Note sudo is not needed for this command as the directory is readable by the pi user.
  6. Type: sudo cp -ai 40-libinput.conf 40-libinput.conf.orig<Enter>
    This command makes a backup copy of the file we will be editing in case it is necessary to fall back.
  7. Type: sudo nano 40-libinput.conf<Enter>
    This command places you in the nano editor and displays the contents of the file.
    Extreme caution should be exercised here as any errant key presses will alter the file and not in a good way (trust me on this one).
  8. Visually locate the section with the identifier "libinput touchscreen catchall"
    This is the section where we must make the edit.
    Reference the image below. Note the image below has the edit already in place. When you first view the file you will of course not see this line.

  1. Using the down and right arrows on the keyboard, place the cursor at the end of the line that contains "Driver libinput" in the correct section.
  2. Type: <Enter>
    This places the cursor on a new line ready for our edit.
  3. Type: Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
    NOTE do not press <Enter> or any other key after typing this.
    NOTE You may enter eight spaces before “Option” if you wish to line it up with the other entries however it is not necessary.
    NOTE there are spaces between all the numerals but no space between the “-” and “1”
  4. Type: <ctrl>x
    This keystroke combination is the command to exit the nano editor. The editor will prompt you at the bottom left of the screen “Save modified buffer?”
  5. Type: y<Enter>
    Pressing y will bring up a second prompt asking for the file name but it defaults to the original file name. By pressing <Enter> right after pressing y we are accepting the original file name.
  6. Type: diff 40-libinput.conf 40-libinput.conf.orig<Enter>
    Note that sudo is not needed for this command as the the user pi has read permissions on these files.
    This command will display the differences between the file we just modified and the copy of the original file we made as a sanity check.
    The expected outcome is 2 lines.
    The first line is line numbers of the difference and can be safely ignored if it differs from your output. I say this because versions supplied in subsequent releases may differ in the number of lines in the file.
    The second line should match exactly to one of the outputs shown below.
   
     Output 1: no additional spaces in front of "Option"
         28d27
         < Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
     Output 2: optional 8 additional spaces in front of "Option"
         28d27
         <         Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
  1. Verify there are only 2 lines and line 2 displays as above. If both of these can be verified, skip to step 29.
  2. If verification in step 26 failed, then
    a. Type: sudo cp -ai 40-libinput.conf.orig 40-libinput.conf<Enter>
    This step will restore the original file while keeping our backup of the original intact.
    b. Go back and perform steps 18 through 26.
    We need to go back and edit the file once again.
  3. else if verification in step 26 succeeded, then continue:
  4. Type: sudo reboot<Enter>
    Perform this command ONLY after verification has PASSED in step 26.
    This command reboots the controller.
    The display and touchscreen should now be rotated 180 degrees.
7 Likes

Please note, DO THIS AT YOUR OWN RISK. This is not supported by Onefinity and doing these steps incorrectly MAY cause your machine to be inoperable.

2 Likes

Somebody buy Mike a beer!

Note: in the complete off-chance that I mess this up, what is the best way to reset the firmware to factory default?

2 Likes

You can also make a backup copy of your existing sd card using the Onefinity video with a few extra steps. This is what I do when I go poking around in unsupported territory. I can make a How-to for this if you’d like.

2 Likes

that would be great, Mike

That would be good for everyone to have on hand
regardless of if you are tweaking your system.

Hey Mike, hey all,

For those who want to know what it means, this page explains it well:

InputCoordinateTransformation - Ubuntu wiki

Invert rotate (clockwise or counterclockwise 180°)

$ xrandr -o inverted

icon_eek Not all graphics drivers support rotation

with a transformation matrix of:

   ⎡ -1  0  1 ⎤
   ⎜  0 -1  1 ⎥
   ⎣  0  0  1 ⎦

It covers how the matrix is to be understood and how you set it on the command line at runtime of X server. The option line above in Mike’s posting is for permanent setting in xorg.conf (and its subparts in xorg.conf.d directory), whose man page says:

Option “TransformationMatrix” “a b c d e f g h i”

  • Specifies the 3x3 transformation matrix for absolute input devices. The input device will be bound to the area given in the matrix. In most configurations, “a” and “e” specify the width and height of the area the device is bound to, and “c” and “f” specify the x and y offset of the area. The value range is 0 to 1, where 1 represents the width or height of all root windows together, 0.5 represents half the area, etc. The values represent a 3x3 matrix, with the first, second and third group of three values representing the first, second and third row of the matrix, respectively. The identity matrix is “1 0 0 0 1 0 0 0 1”.

– Source: xorg.conf(5)

Thank you for the comprehensive step-by-step instructions. I was also happy to see the best-practice of backing up the configuration files before editing and even using -i with cp to help protect people from typos/footguns.

Sad I can only upvote once! :slight_smile:

Thanks again,
U007D

There’s now a button in 1.1.1 that will flip the screen on the settings page :slight_smile:

1 Like

Ah, good to know! I will revert the changes and use the supported UI methodology.

Thanks!

1 Like

Original configuration has been restored.

I cannot Upgrade Firmware via Web to 1.1.1. I am on 1.0.9 and when I try to upgrade it asks me to confirm I want to upgrade to 1.0.9 (but I’m already on 1.0.9).

The unit is on my network (I can SSH in) and has access to the web:

bbmc@onefinity:~ $ ping google.com
PING google.com (142.251.211.238) 56(84) bytes of data.
64 bytes from sea30s13-in-f14.1e100.net (142.251.211.238): icmp_seq=1 ttl=58 time=20.8 ms
64 bytes from sea30s13-in-f14.1e100.net (142.251.211.238): icmp_seq=2 ttl=58 time=18.5 ms
64 bytes from sea30s13-in-f14.1e100.net (142.251.211.238): icmp_seq=3 ttl=58 time=18.3 ms
64 bytes from sea30s13-in-f14.1e100.net (142.251.211.238): icmp_seq=4 ttl=58 time=18.2 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 18.254/18.999/20.850/1.079 ms

And Check Firmware doesn’t appear to do anything (at least in the UI).

Any thoughts?

I think I found the reason 1.0.9 won’t upgrade: 1.1.0 has been yanked and 1.1.1 is not released yet. (I see the 1.1.1-dev release, but I’ll hold off until 1.1.1 is officially released.)

Thanks again for the heads up.