[cpia] A couple of CPiA patches

Akkana akkana@shallowsky.com
Tue, 3 Dec 2002 22:38:47 -0800


--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I've spent the evening playing with my QX3 video microscope, and hit
a couple of problems with the cpia driver and cpia-control.

The driver: How do most people here deal with the fact that the
/proc entry comes up only writable by root?  I didn't want to run
the various camera apps as root (downloaded from who knows where),
but chmod and chown don't work on the /proc device; so after trying
to find other solutions, I finally ended up modifying the driver
to set world-writable permissions on the device.  Is there a better
solution?  I'll attach the patch (vs. driver v. 1.2.2), in case there's
any chance you might want to make this the default or that other
people might want to make the change locally.

I also had a problem with cpia_control (both 0.3.3 and 0.4 have had
the same problem).  Basically, they never run for me -- it always gave
me an error complaining that float("") was illegal.  That turned out
to be coming from the if float(active) check at line 202.  (And I
think it had something to do with the file being unwritable -- after
making the driver patch, I no longer get the cpia-control error.
But I'm sure I'm not the only person who has been unable to use
cpia-control for that reason ...)  Anyway, I attach a (trivial)
patch to check that variable first before calling float() on it.

	...Akkana

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cpiaperms.diff"

--- cpia.c-1.2.2	Tue Dec  3 22:32:56 2002
+++ cpia.c	Tue Dec  3 22:30:50 2002
@@ -1562,7 +1562,8 @@
 
 	sprintf(name, "video%d", cam->vdev.minor);
 	
-	ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root);
+	ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR|S_IWGRP|S_IWOTH,
+                                cpia_proc_root);
 	if (!ent)
 		return;
 

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="float.diff"

--- cpia_control.py.dist	Tue Dec  3 17:06:53 2002
+++ cpia_control.py	Tue Dec  3 22:41:58 2002
@@ -199,7 +199,7 @@
         objects.append(menu_item)
         menu_item.set_name(item)
         menu_item.show()
-        if float(active)==float(item):
+        if active != "" and float(active)==float(item):
             menu_item.set_active(TRUE);
             active_index=index
         group=menu_item

--X1bOJ3K7DJ5YkBrT--