little bash script for grabbing photos off my canon eos 400d

i'm a gadget hound

note: works on netbsd, not necessarily elsewhere, you will need the “progress” application, a port for linux is located here. the european canon eos 400d is the same as the american canon rebel xti and the japanese eos kiss digital x. this script doesn’t care what model you have, and may very well work with other canon cameras or even other brands, as long as you change the memory card location (/dev/sd0e in this example) and the camera’s proprietary directories (/DCIM/100CANON in this example) to the correct names for your camera.

#!/bin/sh
#bash script for grabbing photos from canon eos 400d on my netbsd with a progress bar

/sbin/mount ~/dev/sd0e ~/mnt/cf/ || exit 1
date=`date ‘+%m_%d_%y’`
size=`du -kc ~/mnt/cf/DCIM/100CANON/ | tail -n 1 | cut -f 1`
mkdir -p ~/photos/$date &&
(cd ~/mnt/cf/DCIM/100CANON && tar -cf – *) | (cd ~/photos/$date && progress -l “${size}k” tar -xf -)
/sbin/umount ~/mnt/cf

configuring cgd on netbsd

not enough keyholes

i followed this chapter on cgd for netbsd, but there were a few places where i got stuck and i thought i’d just note them here in case i (or other peeps out there on the interwebs) try to do this again. these notes are in order but be sure to use the cgd chapter. these are more like guidelines anyway.

– to boot into single user mode, reboot then when netbsd is counting down right after the bios, press any key to stop the countdown and then type boot -s to boot in single user mode

– one doesn’t need to use dump to get data off, use netcat + tar to copy to a remote machine (a good option when you don’t have an external drive or cd burner). so on the machine where you want to install cgd, once it’s in single user mode, run:

# tar -czvf – | nc servername port

and on the machine where you are receiving the data:

$ nc -l -p port > file.tgz

– when you are trying to edit partitions with disklabel, know that disklabel on netbsd supports interactive mode with -i and that it isn’t in the disklabel man page at all. to delete the data partitions you want to move to cgd, first launch disklabel in interactive mode, then pull up a partition by typing in the letter of the partition, then choose “unused” for filesystem type, start offset of zero, partition size of zero, then repeat for the other partitions you want to delete, then choose W for write and yes to confirm “label disk?”. that will delete the partitions you need.

– when you need to recreate your new partitions after scrubbing and configuring cgd with a passphrase, run disklabel again in interactive mode and put back the partitions you had the first time following the sizes and names of the partitions from your backup of disklabel you did before starting this whole process. make the new partitions of type 4.2BSD, not ccd. make the partitions in the order in which they were from your original disklabel backup to make adding each one easier (the start point is just the letter of the partition that comes before).

– to copy your data back, use tar and nc in reverse, but you may have to copy apps from /rescue to get things to work and be sure to save your original nc in a place where it won’t get wiped (i.e. save it in /tmp when you are scrubbing your data). when using tar be sure to add the flag to preserve permissions, otherwise you will get some wonky behavior everywhere. vi may be missing so you will need to use cat to edit your fstab and >> to append the cgd=YES line to rc.conf.

other than that, the cgd chapter is quite complete. can i get a w00t for encrypted hard drives please?

lack of 3g (umts) net from nokia e70 on freebsd

WAJD UP!

often i wish i didn’t have to answer “i don’t know” and the last time this irked me was with regards to whether or not my nokia e70 could work tethered (via usb) with 3g, aka umts, with my freebsd laptop. the answer is: “not yet”. here is a bit of the train-of-thought way i got to this answer tonight:

1. rummage around for a data/usb cable for the e70, plug it into the phone and into the freebsd lappy, choose “IP passthrough” mode on the e70, run dmesg in a console.

2. note that the console spits out:

ugen1: Nokia Nokia E70 (RNDIS), rev 2.00/1.00, addr 2

3. search google for that string, nada with or without quotes. search google with:
Nokia E70 (RNDIS) rev 2.00 1.00

ahhhh, two results! one is in russian, the other is a linux kernel patch.

4. skim through the linux kernel patch and realize the important part is RNDIS. search the interwebs for “rndis freebsd” and note that there isn’t a driver written, time to go look what has been written in linux land.

5. go to kernel.org and navigate around until the newest linux kernel is found, not in patch form but in its entirety. download. wait for the download and the subsequent decompression once downloaded. while that is simmering, grab the text file for the patch grabbed earlier and skim a bit more in vim.

6. once the kernel is downloaded and uncompressed, muck around looking for RNDIS in various directories, find a likely subject:

linux-2.6.21.1/drivers/usb/net/rndis_host.c

vim that puppy and begin to read the entertaining comments at the intro to the file:

/*
* RNDIS is NDIS remoted over USB. It’s a MSFT variant of…

um….by MSFT they don’t mean microsoft do they? oh crud. continue reading:

* CONTROL uses CDC “encapsulated commands” with funky notifications…

funky? *chuckle* reading again:

/* RNDIS defines an (absurdly huge) 10 second control timeout

*laugh*, who knew the linux kernel contained such humorous prose?

7. realize the answer is, no virginia there is no santa claus of the e70’s 3g to freebsd variety since there is no port of RNDIS on freebsd. freebsd (or other bsd) developers, feel free to fight over who gets to port this lovely archaic, largely incorrectly documented, m$ protocol.

[pictured above is my modded nokia 6590 which was so garish it shone through my pants pockets with super bright blue strobing leds in true japanese schoolgirl turn-of-the-21st-century style; it was my first nokia and here it is shown being contacted by aliens. it was replaced with my nokia 6230 which has now been superseded by my e70]

Getting Second Life to work on a Linux box

Apparently Linden Labs has an alpha out for Linux. What they fail to mention is that the compiled version is linked against specific versions of openssl and requires a ton of libs I didn’t have installed on my basic Debian install. Window resizing didn’t work either, it crashed the running app but didn’t kill it. A few minutes of lag-tastic blue eyebrow creation later I finally thought to look at top to discover that I was running the whole virtual world twice. That said, once that was resolved, it runs fairly smoothly on a souped up linux box: a 2ghz p4 with 2 gigs of ram and a halfway decent video card.