Batocera on Legion Go

Before Batocera officially add support for the Legion Go, I thought I'd share my findings.

Batocera on Lenovo Legion Go
============================

What works / what doesn't:
[yes] Volume buttons (up/down)
[yes] Screen orientation
[yes] Touchscreen
[yes] Controllers

Need more testing to figure out what is/isn't working.


Instructions:
-------------
Prepare a USB drive with Batocera v38 (batocera-x86_64-x86_64-38-20231014)
Connect USB drive with Batocera to LegionGO
Turn on LegionGO and keep pressing Volume UP button to get into BIOS
Disable Secure Boot in BIOS and reboot
Keep pressing Volume UP button to get to boot menu.
Select Batocera USB to boot from.
Connect USB Keyboard + Mouse
Enable WIFI in Batocera
Login via ssh root@192.168.x.x (password:linux)


Rotate screen:
--------------
nano /userdata/system/custom-es-config

paste the following:

#!/bin/bash
# change the resolution
xrandr -o left

Ctrl+S (to save)
Ctrl+X (to exit nano)
reboot


Fix touchscreen rotation:
-------------------------

cd /usr/share/X11/xorg.conf.d
nano 40-libinput.conf

go to section:

Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection

change it to:

Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection

Ctrl+S (to save)
Ctrl+X (to exit nano)

run commands:
batocera-save-overlay
reboot


Fix controllers:
----------------

cd /etc/udev/rules.d
nano 60-xpadneo.rules

and add the following to the bottom of the file:

# Lenovo Legion Go
ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6182", RUN+="/sbin/modprobe xpad" RUN+="/bin/sh -c 'echo 17ef 6182 > /sys/bus/usb/drivers/xpad/new_id'"

Ctrl+S (to save)
Ctrl+X (to exit nano)

udevadm control --reload-rules && udevadm trigger
udevadm trigger --type=devices --action=add

batocera-save-overlay