PupCamera working again
October 08, 2016 —
BarryK
Ah, it is good to have a digital camera, so that I can test PupCamera. Good, because I found it to be broken, and I fixed it.
Back in 2011, I created PupCamera. There is a udev rule, /etc/udev/rules.d/88-puppy-autodetect.rules, that detects if a camera is plugged in via USB cable, then launches /usr/sbin/pupautodetect, which then launches /usr/sbin/pupcamera.
PupCamera enables viewing and extracting of pictures from the camera.
I plugged in my camera, nothing happened. Two hours later, I finally figured out what is wrong. pupautodetect has this line to detect if X is running:
[ "`pidof X`" == "" ] && exit #X not running.
It is done this way, as the variable DISPLAY is not set when an application is launched from a udev rule.
The problem is, "pidof X" returns nothing. This is because of a change in Ubuntu, and I presume Debian. /usr/bin/X is a symlink to /usr/bin/Xorg, however the latter is now a script, which executes /usr/lib/xorg/Xorg.
Yep, Debian/Ubuntu are at it again, messing around with the file layout.
Anyway, I fixed it:
[ "`pidof X`" ] || [ "`pidof Xorg`" ] || exit
Now I plugged in my camera, and there are all my photos. Just copied the photos across to my hard drive. Yippee!
Note, it "just works" on my Android phone. I connected a USB cable between camera and phone, and immediately all the camera photos were displayed, as thumbnails. Touch one, there was the offer to export it to the phone.
Tags: linux