Frederic98 / GadgetDeck

Use your Steam Deck as an input device on another computer
GNU General Public License v3.0
53 stars 2 forks source link

Trying to get this thing to work! #8

Open unphased opened 10 months ago

unphased commented 10 months ago

The makefile directly runs pyinstaller as well as pip. None of which are available. I tried pacman -S python-pip which installed fine but that gave me

pip install -r requirements.txt
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.

    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.

    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
make: *** [Makefile:31: install] Error 1

Based on the readme you have stated that I only need ssh and a user password set up. I think that is not a comprehensive list.

unphased commented 10 months ago

python and pip is a bit of a sore spot for me. Ever since I started to use docker to avoid python/pip turning my computers into trash heaps, sanity was restored into my life. Unfortunately docker isn't something I can use for low level stuff like this here.

unphased commented 10 months ago

Alright so I did some faffing about and heres where I've gotten so far.

(127)(deck@steamdeck GadgetDeck)$ steamos-add-to-steam /usr/share/gadget-deck/GadgetDeck/GadgetDeck
/usr/bin/xdg-open: line 880: www-browser: command not found
/usr/bin/xdg-open: line 880: links2: command not found
/usr/bin/xdg-open: line 880: elinks: command not found
/usr/bin/xdg-open: line 880: links: command not found
/usr/bin/xdg-open: line 880: lynx: command not found
/usr/bin/xdg-open: line 880: w3m: command not found
xdg-open: no method available for opening 'steam://addnonsteamgame/%2Fusr%2Fshare%2Fgadget-deck%2FGadgetDeck%2FGadgetDeck'

It flat out won't work over ssh. The remedy is to get into desktop mode and run it from the actual steam deck KConsole, various environment stuff allows that script to do its job properly.

Ergo the entire process should probably be run from the steam deck, not over SSH. Which goes against the suggestion to have SSH set up as stated in the readme.

So overall the documentation has been problematic, but I'm nevertheless very excited to try this out once I get the installation completed.

parkerlreed commented 10 months ago

This is a recent upstream packaging change.

You need to use a venv (which also solves your issue of cluttered system)

In the project folder

python -m venv venv 
./venv/bin/pip install -r requirements.txt

Everything will stay contained within that venv folder for that project

unphased commented 10 months ago

So I found in sysctl logs stuff like this

Dec 01 14:20:55 steamdeck systemd[1]: Starting Steam Deck Gadget base...
░░ Subject: A start job for unit gadget-deck-base.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit gadget-deck-base.service has begun execution.
░░
░░ The job identifier is 6709.
Dec 01 14:20:56 steamdeck gadget-deck-manager.py[10558]: Traceback (most recent call last):
Dec 01 14:20:56 steamdeck gadget-deck-manager.py[10558]:   File "/usr/share/gadget-deck/gadget-deck-manager.py", line 8>
Dec 01 14:20:56 steamdeck gadget-deck-manager.py[10558]:     import hid_parser
Dec 01 14:20:56 steamdeck gadget-deck-manager.py[10558]: ModuleNotFoundError: No module named 'hid_parser'

which indicates for me that the venv isnt being activated/found/whatever when launched by steam. Let me try to launch it from ssh with the venv activated.

unphased commented 10 months ago

I tried your suggestion @parkerlreed, calling the pip directly instead of activating the venv, but this still results in

Dec 01 15:18:18 steamdeck systemd[1]: Starting Steam Deck Gadget base...
Dec 01 15:18:18 steamdeck gadget-deck-manager.py[3011]: Traceback (most recent call last):
Dec 01 15:18:18 steamdeck gadget-deck-manager.py[3011]:   File "/usr/share/gadget-deck/gadget-deck-manager.py", line 8, in <m>
Dec 01 15:18:18 steamdeck gadget-deck-manager.py[3011]:     import hid_parser
Dec 01 15:18:18 steamdeck gadget-deck-manager.py[3011]: ModuleNotFoundError: No module named 'hid_parser'
Dec 01 15:18:18 steamdeck systemd[1]: gadget-deck-base.service: Main process exited, code=exited, status=1/FAILURE
Dec 01 15:18:18 steamdeck systemd[1]: gadget-deck-base.service: Failed with result 'exit-code'.
Dec 01 15:18:18 steamdeck systemd[1]: Failed to start Steam Deck Gadget base.

The package got installed here

(deck@steamdeck GadgetDeck)$ find / | grep hid_parser
find: ‘/efi’: Permission denied
find: ‘/esp’: Permission denied
find: ‘/home/lost+found’: Permission denied
find: ‘/home/.steamos/offload/var/log/private’: Permission denied
find: ‘/home/.steamos/offload/var/tmp/systemd-private-aabca95cbab9487ca9130496547e89b6-systemd-resolved.service-VxPoRq’: Permission denied
find: ‘/home/.steamos/offload/var/tmp/systemd-private-aabca95cbab9487ca9130496547e89b6-iwd.service-GsRrga’: Permission denied
find: ‘/home/.steamos/offload/var/tmp/systemd-private-aabca95cbab9487ca9130496547e89b6-systemd-logind.service-tXIyH1’: Permission denied
find: ‘/home/.steamos/offload/var/tmp/systemd-private-aabca95cbab9487ca9130496547e89b6-upower.service-QJM1F9’: Permission denied
find: ‘/home/.steamos/offload/var/tmp/systemd-private-aabca95cbab9487ca9130496547e89b6-bluetooth.service-pl21wO’: Permission denied
find: ‘/home/.steamos/offload/var/tmp/systemd-private-aabca95cbab9487ca9130496547e89b6-systemd-timesyncd.service-OlxS5Z’: Permission denied
find: ‘/home/.steamos/offload/root’: Permission denied
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/LICENSE
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/REQUESTED
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/direct_url.json
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/WHEEL
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/RECORD
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/INSTALLER
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/top_level.txt
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/METADATA
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser/__init__.py
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser/__pycache__
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser/__pycache__/data.cpython-311.pyc
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser/__pycache__/__init__.cpython-311.pyc
/home/deck/GadgetDeck-attempt/GadgetDeck/myenv/lib/python3.11/site-packages/hid_parser/data.py
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/LICENSE
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/REQUESTED
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/direct_url.json
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/WHEEL
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/RECORD
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/INSTALLER
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/top_level.txt
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser-0.0.3.dist-info/METADATA
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser/__init__.py
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser/__pycache__
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser/__pycache__/data.cpython-311.pyc
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser/__pycache__/__init__.cpython-311.pyc
/home/deck/GadgetDeck/venv/lib/python3.11/site-packages/hid_parser/data.py

They are not global locations (running pip from venv bin does not cause that pip to install anything globally, but then again, my brain still seems allergic to venv, and clearly this software expects the packages to be installed globally, yet the only way that seems sensible to install it is non-globally, so I am not sure where to go). Ignore the GadgetDeck-attempt/ in the home dir. I should have just deleted that previous attempt.

parkerlreed commented 10 months ago

You would have to edit the service to point to the absolute path of the venv python (its still using your system version)

/home/deck/GadgetDeck/venv/bin/python

unphased commented 10 months ago

Yeah it seems like we need to modify all services to make calls to /bin/bash -c 'source /home/user/myproject/venv/bin/activate && <python script call> which is mega awkward. It seems like I have the information required to post PR at this point. I'll go to sleep now. Thanks.

unphased commented 10 months ago

I found eventually that the venv creation actually creates little shell scripts for pip and such that have an absolute path in the shebang, e.g. the venv/bin/pip3 python script has a shebang of #!/home/deck/GadgetDeck/venv/bin/python which obviously i have moved by now, so I guess I will do more surgery

unphased commented 10 months ago

alright well i was able to fiddle with the venv stuff enough to make it work but joystick passthrough does not work. the keyboard functionality works perfectly however.

unphased commented 10 months ago

@parkerlreed do you know if this could ever work? Did you get it working before? Is it still working for you now? I got the app running and keyboard totally works, but it seems like gadgetdeck just isn't receiving joystick events. I have installed jstest using pacman -S linuxconsole and jstest also shows no joystick events. It shows

Driver version is 2.1.0.
Joystick (Microsoft X-Box 360 pad 0) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 11 buttons (BtnA, BtnB, BtnX, BtnY, BtnTL, BtnTR, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).

and a bunch of rows for axes but nothing ever updates. if i run the event streaming modes with jstest no events are coming in. Did Steam disable our ability to get joystick input from the kernel for security reasons?

unphased commented 10 months ago

seems like the way that we receive and process input is well defined from the GadgetDeck application: https://github.com/Frederic98/GadgetDeck/blob/main/GadgetDeck/__main__.py#L49C26-L88

I suspect somewhere in here Valve has adjusted something over the past year, and we just need to work out how to receive the input properly again.

Need to obtain build steps for the app however... because with the way we deploy the software onto the steam deck it is just a prebuilt executable so I can't hack on the code in there.

It's probably possible to make progress on fixing the steamworks api calls and such and get the joystick events, but the above will still be the roadblock.

unphased commented 10 months ago

I thought about it some more, and I think even if the steamworks api itself hasn't changed, it stands to reason that whatever method was used to bundle the qt app into an application for us to willy nilly install probably bundles an old and now noncompatible steamworks/steaminput api, at least for the python side of things, since i can tell that the steamclient.so dynamic linking done by the app is performed successfully (again, keyboard already works): [S_API] SteamAPI_Init(): Loaded '/home/deck/.local/share/Steam/linux64/steamclient.so' OK.

unphased commented 10 months ago

According to https://github.com/Frederic98/GadgetDeck/issues/1#issuecomment-1410101971 at some point full build on deck was possible. hmm. but this pre-dates the most recent changes. i suppose first step will be to try to get steamworkspy to work at all building on the deck, should not be too hard to explore this.