kishorviswanathan / ChromePad

Virtual GamePad for Chrome OS
5 stars 1 forks source link

No module named uinput? #8

Open hyperxmason opened 1 year ago

hyperxmason commented 1 year ago

I'm trying to use this it looks super cool am I doing something wrong?

kishorviswanathan commented 1 year ago

This is probably an issue with the python version. Python on the chrome OS was upgraded to python3. I have a test branch with support for python3. Could you please test and let me know if it is working ?

Steps:

  1. Save the below code as install.sh
  2. Run the file with bash install.sh
  3. See if sudo chromepad is working.
#!/bin/bash

INSTALLDIR=/usr/local/bin

printf "Installing / Updating ChromePad\n"

# Install crew if required
if ! [ -x "$(command -v crew)" ];  then 
  printf "Installing ChromeBrew\n"
  curl -Ls git.io/vddgY | bash
fi

# Install python
printf "Installing Python & Udev Library \n"
yes | crew install python3 eudev
printf "Installing Python Module \n"
sudo python3 -m pip install python-uinput

# Install ChromePad
printf "Copying ChromePad files to %s \n" $INSTALLDIR

# Remove old files
sudo rm $INSTALLDIR/chromepad $INSTALLDIR/GamePad.py 2>/dev/null

# Download GamePad.py
if ! [ -f "GamePad.py" ]; then
  curl -Ls https://raw.githubusercontent.com/kishorv06/ChromePad/python3-migration/GamePad.py > GamePad.py
fi
chmod a+x GamePad.py
sudo mv GamePad.py $INSTALLDIR

# Generate wrapper script
sudo tee $INSTALLDIR/chromepad << EOF >> /dev/null
#!/bin/bash
printf "[    ]  Checking if user is root"
if ! [[ \$EUID = 0 ]]; then
  printf "\rPlease run as root. ie sudo chromepad \n"
  exit
fi
printf "\r[ OK ]  Checking if user is root\n"
printf "[    ]  Loading uinput module"
modprobe uinput
printf "\r[ OK ]  Loading uinput module\n"
printf "[ OK ]  Starting ChromePad Server\n"
clear
python3 $INSTALLDIR/GamePad.py
EOF
sudo chmod a+x $INSTALLDIR/chromepad

echo "Successfully installed ChromePad."
hyperxmason commented 1 year ago

Hey thanks so much man I'll let you know if it works ill be able to test this on Tuesday I'm going out of town so I won't have my chromebook until then.

kishorviswanathan commented 1 year ago

No problem. Please check and let me know when you get time.

hyperxmason commented 1 year ago

Hi I saved the file as install.sh did sudo chmod 755 install.sh bash install.sh it finished and this is what I got.

Acer Chromebook 315

Traceback (most recent call last): File "/usr/local/bin/GamePad.py", line 3, in import uinput ModuleNotFoundError: No module named 'uinput'

hyperxmason commented 1 year ago

Collecting python-uinput Using cached python-uinput-0.11.2.tar.gz (26 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: python-uinput Building wheel for python-uinput (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [9 lines of output] x86_64-cros-linux-gnu-gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory compilation terminated. error: command '/usr/local/bin/x86_64-cros-linux-gnu-gcc' failed with exit code 1 In file included from /usr/local/include/errno.h:28, from libsuinput/src/suinput.c:19: /usr/local/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory 26 | # include <linux/errno.h> | ^~~~~~~ compilation terminated. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for python-uinput Running setup.py clean for python-uinput Failed to build python-uinput Installing collected packages: python-uinput Running setup.py install for python-uinput ... error error: subprocess-exited-with-error

× Running setup.py install for python-uinput did not run successfully. │ exit code: 1 ╰─> [11 lines of output] /usr/local/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( x86_64-cros-linux-gnu-gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory compilation terminated. error: command '/usr/local/bin/x86_64-cros-linux-gnu-gcc' failed with exit code 1 In file included from /usr/local/include/errno.h:28, from libsuinput/src/suinput.c:19: /usr/local/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory 26 | # include <linux/errno.h> | ^~~~~~~ compilation terminated. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> python-uinput

note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

kishorviswanathan commented 1 year ago

Looks like the installation of python module python-uinput failed. There is a package on debian based distros, linux-libc-dev, which provides the missing header files. I found a package glibc for chromeos, but not sure if it is the right one. Could you please try running crew install glibc and then run the install.sh script again ?

hyperxmason commented 1 year ago

Hey man so I went to go install glibc but unfortunately it said it was already installed I ran the command anyways ran the install.sh and I still get no module named uinput.

kishorviswanathan commented 1 year ago

I have no idea how to solve this. Since this is Chrome OS, google is not giving any results either. Could you try the whatprovides command of crew to identify which package provides errno.h ? If you find one, install that package and try again.