Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bullseye convert hyperpixel-touch script to python3 #54

Closed
pwr33 opened this issue Nov 13, 2021 · 3 comments
Closed

bullseye convert hyperpixel-touch script to python3 #54

pwr33 opened this issue Nov 13, 2021 · 3 comments

Comments

@pwr33
Copy link

pwr33 commented Nov 13, 2021

python2-pip gone and that sort of problem, so convert it to python3?

simply change the shebang to python3

basically you use some odd old python2 function file(), converting to python open() works ok except for the se file which fails on the os.dup(). cant find the old python documentation on the file() function it is that old...

any ideas

@Gadgetoid
Copy link
Member

Looks like this is a very similar set of changes - https://github.com/pimoroni/phat-beat/pull/37/files

For stderr:

se = open("/dev/null", "ab+", 0)
os.dup2(se.fileno(), sys.stderr.fileno())

Works for me on Python 3.8

@pwr33
Copy link
Author

pwr33 commented Feb 4, 2022

Hi, been a while, just spent a bit more time on it, it is now failing on the line below
bus = smbus.SMBus(3)

does it need a udev rule or something?
there is no /dev/i2c-3

Tried compiling the overlays and that gave warnings, so I'm thinking its the same as with the hyperpixel4, stick with buster if you want the touch screen ???

====

File "/usr/bin/hyperpixel-touch", line 117, in
bus = smbus.SMBus(3)
FileNotFoundError: [Errno 2] No such file or directory
Exception ignored in: <function InputDevice.del at 0xb612ebb0>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/evdev/device.py", line 160, in del
File "/usr/lib/python3/dist-packages/evdev/device.py", line 305, in close
File "/usr/lib/python3/dist-packages/evdev/eventio_async.py", line 55, in close
File "/usr/lib/python3.9/asyncio/events.py", line 725, in get_event_loop_policy
File "/usr/lib/python3.9/asyncio/events.py", line 718, in _init_event_loop_policy
ImportError: sys.meta_path is None, Python is likely shutting down

@pwr33
Copy link
Author

pwr33 commented Oct 5, 2022

OK, it is now SMBus(11) on buster and bullseye

And to stop a segfault, change

/usr/lib/systemd/system/triggerhappy.socket
[Socket]
remove ListenStream=/run/thd.socket
replace with ListenDatagram=/run/thd.socket

works for me anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants