Monday, 19 March 2007

I want to be a janitor

I just read a great article entitled, "Myths, Lies, and Truths about the Linux kernel".  I found it quite inspirational and it taught me a couple of things - always good.


For a start, I was unaware of the kernel janitors project.


It seems a good way to get involved in some kernel development and give back to the community that I've mostly taken for granted. I'll probably have to learn git, ketchup, cscope and quilt -- and I'll certainly have to brush up on my C skills but, again, all feathers in the cap.


One question remains. Where will I be able to work on this kernel?


I can't have my main PC up-and-down. Oh wait, thank god for VMWare.

Wednesday, 14 March 2007

Drop Gear?

The unthinkable has happened.


Jeremy Clarkson has said Top Gear won't be back in the summer.


What!? How the... what the... but I was watching that!


It seems to be the usual problems for this kind of show. Contracts, budgets, government lobby groups, green activists, etc. Poor Top Gear takes a lot of heat for glorifying the car and its lack of regard for the environment.


We all know the state of the public transport system is really to blame. Crap trains, expensive buses, cramped tubes and abysmal cycling conditions. That and the big green push at the moment all adds up to a well-timed cancellation.


Top Gear is a one-of-a-kind and the world will be a sadder place without it. They've tried to come up with similar whacky shows that attempt crazy stunts, but none of them match the cinematic quality and hyperbole that the BBC has provided. They've proved it by winning an International Emmy and being nominated for several other awards.


Please, BBC. Don't drop this one.

Monday, 12 March 2007

Fujifilm remote capture stream.c diff

[See also, Time Lapse Photography, Part 1]

stream.c
--- stream.c    2007-03-11 18:00:53.000000000 +0000
+++ stream.c.new        2007-03-11 18:01:22.000000000 +0000
@@ -30,7 +30,8 @@
        for (dev = bus->devices; dev; dev = dev->next) {
            if (dev->descriptor.idVendor == 0x04cb) {
                // OK, it's a FUJI
-               if (dev->descriptor.idProduct == 0x0125) {
+               if (dev->descriptor.idProduct == 0x0125
+                   || dev->descriptor.idProduct == 0x010b) {
                    printf("Found it on bus %d(%s), dev %s.n",
                           bus->location, bus->dirname, dev->filename);
                    // our product
@@ -50,8 +51,14 @@
 #define BULK_WRITE_ENDPOINT   0x02
 #define INTR_ENDPOINT         0x03

+#define        DEBUG_OUTPUT                    0
+
+#if DEBUG_OUTPUT
 #define DEBUG(txt, ...) 
   fprintf(stderr, "DEBUG[%s:%d]: " txt "n", __FUNCTION__, __LINE__, ##__VA_ARGS__);
+#else
+#define DEBUG(txt, ...) fprintf(stderr,"");
+#endif

 #define VERIFY(code) 
   code; 
@@ -242,8 +249,6 @@
        DEBUG("Frame [2]");
        len = usb_bulk_read(udev, BULK_READ_ENDPOINT, buf, 0x2000, 3000);
        if (len < 0) {
-           fprintf(stderr, "Failed to get bulk frame datan");
-           return frame;
            frame_free(frame);
            return NULL;
        }
@@ -260,6 +265,7 @@
     int res;
     int i;
     struct usb_interface_descriptor *intf;
+    struct frame *frame;

     usb_init();
     usb_find_busses();
@@ -267,7 +273,7 @@

     dev = find_our_black_sheep();
     if (!dev) {
-       fprintf(stderr, "No FUJI FinePix A310 found.n");
+       fprintf(stderr, "No FUJI FinePix found.n");
        goto end;
     }

@@ -311,19 +317,19 @@
        if (argc > 1)
            count = atol(argv[1]);

-       for (i = 0; count-- > 0; ++i) {
+       for (i = 0; i < count; i++) {
            char filename[32];
-           struct frame *frame = get_frame();
-           if (!frame) {
-               fprintf(stderr, "Can't get framen");
-               break;
-           }
+           frame = get_frame();
+           if (frame) {
                sprintf(filename, "out/frame%05d.jpg", i);
                FILE *f = fopen(filename, "wb");
                fwrite(frame->data, frame->length, 1, f);
-               frame_free(frame);
                fflush(f);
                fclose(f);
+           } else {
+               fprintf(stderr,
+                       "Problem with frame %05d.  Trying again.n", i--);
+           }
        }
     }

Time lapse photography. Part 1.

Time lapse photography is something I've wanted to try for a while.


But how exactly would I do it?


I've got an old digital camera lying about, a Fujifilm S602 zoom, that I could use. Of course I'd have to hook it up to the PC and get it to capture the images at regular intervals.


Again, how exactly would I do that?


A quick scour of Google revealed a couple of projects.


Finepix uses it's own kernel driver and it plugs into Video4Linux. I didn't get this to work initially.


I then found Mishoo's personal project to get his A310 capturing images.


This second one is much simpler and uses libusb to control the camera and it's a single binary.


Once I'd switched the camera into PC-Cam mode, it worked straight away. It had a few problems so I tidied it up a little and it now does something close to what I want.


Next steps... get it capturing decent images on a regular basis and then turning the photos into an AVI.


PS: It turns out that the power supply for my old Creative Zen MP3 player also works as DC-in for the S602 zoom.