pimoroni / inky

Combined library for V2/V3 Inky pHAT and Inky wHAT.
https://shop.pimoroni.com/?q=inky
MIT License
575 stars 121 forks source link

Odd permissions issue on new Inky Impressions 7.3" #176

Closed Sal-Tepedino closed 11 months ago

Sal-Tepedino commented 12 months ago

I have two Impressions now, a 5.7" I've had for a while and a new 7.3" I'm setting up now. I've run into a weird issue that appears to be permissions-based, but somehow at the level of the screen itself. Both of my setups are running on Pi Zero Ws with Raspbian 11, and all of the latest packages installed.

On my 5.7", when running 'identify.py' I get:

$ ./identify.py 
Found: 7-Colour (UC8159)
Display: 600x447
Color: None
PCB Variant: 1.2
Display Variant: 14
Time: b'2022-09-29 10:58:30.9'

And on my 7.3" I get:

$ ./identify.py 
Found: None
Display: 800x480
Color: None
PCB Variant: 1.0
Display Variant: 20
Time: b'2023-08-21 08:48:46.6'

Except, if I run it as root, I get:

$ sudo ./identify.py
Found: 7-Colour 800x480 (AC073TC1A)
Display: 800x480
Color: None
PCB Variant: 1.0
Display Variant: 20
Time: b'2023-08-21 08:48:46.6'

Similarly, none of the other examples will run unless I run them as root:

$ ./name-badge.py --name Test
Inky pHAT/wHAT: Hello... my name is:

Use Inky pHAT/wHAT as a personalised name badge!

Detected None
Failed to detect an Inky board. Trying --type/--colour arguments instead...

usage: name-badge.py [-h] [--simulate] --type {what,phat,phatssd1608,impressions,7colour,whatssd1683} [--colour {red,black,yellow}]
name-badge.py: error: the following arguments are required: --type/-t

And specifying the type as shown does not resolve the issue.:

$ ./name-badge.py --type 7colour --name Test
Inky pHAT/wHAT: Hello... my name is:

Use Inky pHAT/wHAT as a personalised name badge!

Detected None
Failed to detect an Inky board. Trying --type/--colour arguments instead...

/home/sal/.local/lib/python3.9/site-packages/inky/inky_uc8159.py:302: UserWarning: Busy Wait: Held high. Waiting for 32.00s
  warnings.warn("Busy Wait: Held high. Waiting for {:0.2f}s".format(timeout))
/home/sal/.local/lib/python3.9/site-packages/inky/inky_uc8159.py:302: UserWarning: Busy Wait: Held high. Waiting for 0.20s
  warnings.warn("Busy Wait: Held high. Waiting for {:0.2f}s".format(timeout))

To eliminate variables, I tried to swap the sdcards from the two installs, to see if it was the setup itself, but the 5.7" install had the same issue running with the 7.3" screen, and the 7 install had no issues working with the 5 screen. I then swapped the entire Pi Zero from the known working setup onto the new screen and it still had the same issue.

Seeing as the only variable is the screen itself, I'm thinking that there's something different there, either hardware or firmware-wise. I also have the busy/wait issue #1876581066 and don't have that on the other Impressions, so perhaps it's related.

The 7color/image.py script does work fine when running as root, which is what I'm using the screen for, so I'm not dead in the water, but I figured A: If someone else has this issue, they can refer to this, and B: Help fix the issue.

Sal-Tepedino commented 11 months ago

After working with some fine folks on the Pimoroni forum, we tracked this problem down to the difference between the system install of python packages, and the user install of packages. I just didn't click in my head that there were two separate installs on the system, which might have been more obvious to me if I was a python coder. The system install was up to date, however the user install wasn't, and when I was running the commands as myself, it was preferring the out of date user install, which cased this issue, while when running as root, it just used the system install and worked fine.

My fix was as simple as deleting ~/.local/lib/python3.9/ which caused python to use the system's install.

Though, be careful with that solution because you may have packages in the user install that you need. I initially just moved it to test if everything worked ok, and it did for me. You could also update the user packages, though my system was complaining with 'Illegal operation' errors when I tried that earlier in my troubleshooting, so this was probably the best solution for me.