mrworf / photoframe

Software to pull random photos from Google Photos and show them, like a photo frame
GNU General Public License v3.0
223 stars 38 forks source link

Pi Zero 2 W #200

Closed b1ane22 closed 2 years ago

b1ane22 commented 2 years ago

Trying to boot the pre-built image on the Zero 2 W and does not work. Won’t even boot. I know that the 2W requires the latest OS release, which does work with a new Raspbian image. Will I have to install photoframe manually?

dadr commented 2 years ago

The latest Raspberry Pi OS has redone the video driver (in a good way - making it more like garden variety linux systems). But it also deprecated the tvservice program that managed the old video driver and which is used extensively in photoframe.

However I think you can still get this to work... You can try the following: Install manually, and make sure you install the "lite legacy" version of the OS - this should put in the legacy video driver. I've just finished up another commit to the V2 frame, and if @mrworf accepts it, then you can use the instructions for the "Python3" branch. If you can't wait, (and if you are willing to try something that may still have bugs) you can follow the instructions in the readme at my working branch: https://github.com/dadr/photoframe/tree/python3

The one difference is in the line that clones the repo to the Raspberry pi, to test use this line instead: git clone --branch python3 --single-branch https://github.com/dadr/photoframe.git it changes mrworf to dadr - and for fair warning, you will probably have to install manually again, once this is all ready for production. However, I'd love to hear your comments and inputs on the new version - especially about any bugs.

I'll try to install on Bullseye as well, and see how that works. But that will be more than a week from now, I have to go to my brother-in-law's funeral. (Covid)

dadr commented 2 years ago

By the way, I made a photoframe with a Pi 3A which has similar cores and memory, and from that system I think that the Zero 2W will be a great platform for this.

b1ane22 commented 2 years ago

Thank you! I was trying to install all the packages with python3 using Bullseye build but was just getting stuck. I just got done installing the branch version and it seems to be working with the web interface, however I can't upload any new display drivers. When I upload through the web portal it says "Upload complete, refreshing drivers" but they're not selectable via the dropdown. Now, on the pi I do see the zip files in /photoframe/display-drivers but don't see them in /photoframe_config/display-drivers.

dadr commented 2 years ago

Thanks b1ane22, that might be a bug. I don't have any systems that use the display drivers, so I have not tested those. Perhaps @mrworf can give it a try?

mrworf commented 2 years ago

It's been a while since I tinkered with that. Can you share logs from this? There should be a bunch of logs to help us with this.

b1ane22 commented 2 years ago

Absolutely! I am trying to complete another 7" and 5" LCD photoframe for myself and the fiancés' family. The first one I built, I did with just the Zero W and worked perfectly! I see it's trying to extract the zipfile but failing for some reason. I downloaded the sample ones from the \photoframe\display-drivers and also tried re-making them manually using the readme file. All failed so far. Here are the log files. photoframe log.txt stacktrace.txt sys log.txt

mrworf commented 2 years ago

Hmm... could you be missing unzip ? See if /usr/bin/unzip exists and works

mrworf commented 2 years ago

sudo apt install unzip should be the ticket to solve that if that's the case

b1ane22 commented 2 years ago

/usr/bin/unzip did exist. Once I was in /photoframe/display-drivers I was able to unzip the files and they're now showing via dropdown on the webpage but once selected doesn't reboot like my working one.

b1ane22 commented 2 years ago

Did not mean to close it. Here's the new logs photoframe log 1.txt .

mrworf commented 2 years ago

what zip file did you upload to the photoframe? Seems like the manifest.json file is missing?

b1ane22 commented 2 years ago

I tried all of them from here https://github.com/mrworf/photoframe/tree/master/display-drivers

mrworf commented 2 years ago

Looking at the code, this file is generated (sorry, it's been a while :)). We need to find out why it can't unzip since there's more to this flow than just unzipping.

If you feel comfortable editing the files, here's what I propose you do for the modules/drivers.py

On line 145, which says

result = subprocess.check_call(['/usr/bin/unzip', file, '-d', os.path.join(folder, extra)], stdout=self.void, stderr=self.void)

change this to

logging.info('path: "%s"', os.path.join(folder, extra))
result = subprocess.check_call(['/usr/bin/unzip', file, '-d', os.path.join(folder, extra)])

This should capture the output from the command in syslog and with logging.info we'll know what folder it was trying to unzip to.

Please note that this hasn't been tested, since I'm not at my desktop at the moment, but I believe this will give us the details we need to know what's going on here.

b1ane22 commented 2 years ago

Okay, so I was able to change the code and I removed all files from /photoframe/display-drivers and /photoframe_config/display-drivers so we can start fresh. Then I tried uploading the waveshare7 driver and the waveshare35adriver. Now, it actually shows in the dropdown but when I select it, nothing happens. Here are the logs: photoframe log 2.txt sys log 2.txt

b1ane22 commented 2 years ago

I fixed it!

In the drivers.py code, line 265 needs to be updated from with open('/boot/config.txt.new', 'wb') as f: to with open('/boot/config.txt.new', 'w') as f:

I found it in the syslog:

Jan 17 23:46:18 raspberrypi photoframe[467]:   File "/root/photoframe/modules/drivers.py", line 269, in activate
Jan 17 23:46:18 raspberrypi photoframe[467]:     f.write('%s\n' % line)
Jan 17 23:46:18 raspberrypi photoframe[467]: TypeError: a bytes-like object is required, not 'str'

Found this link and was able to update and test! I have the 7" LCD finally working as it should! https://stackoverflow.com/questions/33054527/typeerror-a-bytes-like-object-is-required-not-str-when-writing-to-a-file-in