Tenrec-Builders / pi-scan

Pi Scan is a simple, robust capture appliance for book scanners. It runs on a Raspberry Pi 2.
BSD 2-Clause "Simplified" License
264 stars 37 forks source link

Comment out iso_to_av96 and update cython version #7

Open lazzarello opened 7 years ago

lazzarello commented 7 years ago

Two build issues

  1. The Kivy of today depends on a newer version of cython. Update it.
  2. The chdkptp.py upstream HEAD has a different API than the one included in the Rpi image

The first exception is the method name iso_to_sv96 has been changed to iso_to_av96. I updated the method call and expected it to just work. Then I got a new exception when calling the updated method.

>>> chdkptp.util.iso_to_av96(100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/chdkptp/util.py", line 7, in iso_to_av96
    return global_lua.globals.exposure.iso_to_av96(iso)
TypeError: 'NoneType' object is not callable

I searched through the pi-scan codebase for the string svm and it doesn't appear anywhere except in this option dict, which I think is trying to set the ISO to a value of 100. I commented this out and things are working as expected.

I would like to bring the API up to date but it's not directly related to my project. If it's cool with you the comment seems to fix the functionality on my end.

duerig commented 7 years ago

Take a look at my chdkptp.py fork here:

https://github.com/duerig/chdkptp.py/commits/master

This (and the other commit) are essential bugfixes. I meant to make a PR for Johannes, but I see that I have forgotten. Now that is rectified here: https://github.com/jbaiter/chdkptp.py/pull/5

The iso_to_av96 thing isn't an interface change. It was just a bug in the original code. If we don't set ISO at all, then the quality of the resulting image will be reduced. When I was playing around with this, fixing the bug made a significant difference to apparent graininess.

I'm also working on integrating the build script into the new pi-gen script that generates Raspberry Pi images. I should have that done this week. I'll pull in your build change to that.

duerig commented 7 years ago

Johannes as now accepted my pull request fixing the chdkptp.py bug. So pull the latest version from him, revert that line, and things should work.

Regarding falling back to the local filesystem: most Pi Scan installations are running on read-only filesystems. An overlay makes them look read-writable but any changes will disappear on reboot and writing to them consumes RAM. So for your fallback to work consistently on other installations, it needs to check for this case and only fallback if the local filesystem is truly read-writable and not just a copy-on-write ramdisk.