Syncing iPod Touch and iPhone with Linux

Ok, so I just tried out the new libimobiledevice. Installation was a breeze, using the provided OpenSUSE repository. A first run of ideviceinfo returned successfully detailed information about the attached iPod Touch. I also upgraded libgpod4. But Amarok 2.3 did not show a thing. Mounting of the iPod needed to be done manually using “ifuse ~/my-ipod-dir”. Supposedly, this happens automatically with Gnome, usin gvfs. But since I am using KDE, this is at the moment a no-go. Ok, so Amarok fails at this point in time. What about gtkpod? It works, although it throws some mysterious error message (“Eweiterte Informationen werden nicht verwendet” — wtf?), and that program is dog-slow. I though iTunes is bad, but this program is really, really slow as a snail. But here a proof of concept that I was able to sync to albums to the device:


What I did not yet try is syncing contacts, notes and bookmarks. With gtkpod, you need to specify a program to do that. No idea which one that is supposed to be. Keeping my MobileMe contacts in sync with my Linux desktop would be nice, though. Also, syncing from within Amarok is mandatory for me, but does not work currently. So let’s wait and hope the situation gets better with time. So far I will continue to sync my device with OS X.

Extremely slow SMB performance over WiFi using OS X

I have an OpenSUSE machine running a Samba server to provide files to my network. Now when I use the MacBook Pro to access those files, this happens awfully slow, with 80-200 KiB per second. I never figured out why, since rsync and sftp work very fast (for WiFi at least), at speeds of around 1.2 MiB per second. Today I googled for it, and it turns out that OS X delays ACK packages. I have no clue why it does that and what good this does, but you can disable it by running:

sudo sysctl -w net.inet.tcp.delayed_ack=0
After that, my SMB transfers jumped to 1 MiB per second, minimum. You can presumably make this change permanent by adding “net.inet.tcp.delayed_ack=0” to the file /etc/sysctl.conf. This will then be applied during system startup.
Update: Here is a nice explanation why the performance of OS X suffers sometimes, when using delayed ACK, and also why it might be useful in some cases.

OpenCL on OS X

I have just tried to run an official OpenCL sample program by Apple on a MBP 10.6.3 machine. Result: a crash. Why? I do not know yet, but it seems that OpenCL somehow crashlanded the nvidia OpenGL driver. This is what I get:
08.04.10 17:04:50 kernel NVDA(OpenGL): Channel exception! exception type = 0xd = GR: SW Notify Error
08.04.10 17:04:50 kernel 0000006e
08.04.10 17:04:50 kernel 00200000 00008397 00000474 00000040
08.04.10 17:04:50 kernel 0000047e 00001408 00000001 00000008
08.04.10 17:04:50 kernel 00000000 00000000 01dfdc03
08.04.10 17:05:04 kernel NVDA(OpenGL): Channel exception! exception type = 0x8 = Fifo: Watchdog Timeout Error
08.04.10 17:05:04 kernel 0000006e
08.04.10 17:05:04 kernel 00000010 00008397 00000474 00000000
08.04.10 17:05:04 kernel 0000047e 00001528 00000000 00000008
08.04.10 17:05:04 kernel 00000000 00000000 019fdc03
As soon as I know something more and especially how to fix it, I will share it here.
Update: It does not crash, if I don’t touch any keys when the kernel runs. So I guess the OpenCL drivers are a bit buggy still…

SD card reading problems

Today I was shooting some pictures using some camera and a cheap 2GB SD card. Upon returning home, I copied the pictures from the SD card to the Mac, using an old 6-in-1 card reader. After about 980 MiB of images, OS X throws a read error. Using cp in terminal yields the same result. Trying to repair the card using the hard disk utility even resulted in the system hanging. No hard freeze, but I had to power cycle it, since I was too lazy to fire up another ssh-capable machine.
After some research, I read on Wikipedia that SD cards over 1 GiB are adressed differently. It seems that older devices, such as my reader may have problems using those cards. This means I have to go buy a new reader tomorrow, I guess! Or be restricted to using only 1 Gig of the SD cards I use… Which is not a good idea for camera producing 37 MiB RAW files.

Update: My suspicion was correct. A new 10 € card reader solved the problem. The 2 GiB are back, I can read all the photos from the card.

Automatic security updates for Debian

I was wondering how to configure automatic security updates for Debian. Especially for Debian stable, which I am running. Turns out it’s easy. First, you just install cron-apt. Second, you can configure it by editing /etc/cron-apt/config. I learned from some other blog, that setting one variable helps in getting actually emails for the upgrades, namely setting MAILON=”upgrade” in this file does the trick. And lastly, there is a directory /etc/cron-apt/action.d, which contains all the actions that cron-apt will execute. In there is a file named 3-download, which I changed to look as follows:

autoclean -y
upgrade -y -o APT::Get::Show-Upgraded=true
The second line is changed from “dist-upgrade -d …”, because you don’t want any automatic dist-upgrades. That might leave your server in a horrible state. Also, instead of only downloading (-d), you want it to install the upgrades as well. That’s all and should help you keep up with security patches more easily.
Update: The updates seem to work fine! Tonight I got the first email that notified me of a successful security update.

Tivoli Storage Manager: Servername not found

The infamous Tivoli Storage Manager client (a.k.a. dsmc) uses two configuration files: dsm.sys for the system wide configuration, specifying which directories to backup and so on, and the dsm.opt for the backup/restore client. The problem is, if you specify the backup SERVERNAME in both files, this will lead to problems, if they are not the same. So, e.g. I misconfigured the dsm.opt via the dsmj wizard, and had “SERVERNAME myhost” in the dsm.opt, while the dsm.sys said “SERVERNAME something.at.rwth-aachen.de”. The first entry obviously was complete bull, and confused the dsmc, so that it answered “ANS1217E Server name not found in System Options File”. Aligning both entries to the correct, real server name solves this problem.

iPhone / iPhoto syncing woes

I just tried to download a couple of images from my iPhone, using iPhoto ’08. No luck. Suddenly the iPhone was not listed anymore in iPhoto! It turned out that something on the iPhone was broken / corrupt. When I looked at the device using the Image Capture program, I got this:
As you can see the devices section lists 24 images on the phone, but the photo list is empty. Deleting the pictures on the device restored the functionality. If you need the photos badly, you can forward them to your email or MobileMe account, and then delete them.
Sometimes it is so much better to just have a plain filesystem with photos, instead of some advanced database, that might break…

Bug in ff-find-other-file of Emacs 22?

I am working on a C++ project which is organized such that source files (*.cc) are in some subdir called, let’s say, project/dir1/, and header files (*.h) in a directory called project/include/. Now Emacs has a function called ff-find-other-file, which is able to switch between header and implementation of C/C++ files. If you take a look at the source of this function, you will find another function called ff-get-file-name, which tries the following: first, it looks for already visited buffers, if they contain the appropriate file. Then it will search a certain set of directories, if they contain the file. Last, it will ask to find or create the file in a user specified directory. However, in my case, although both files are already being visited by buffers, the first test (finding the file in already loaded buffers) fails. Actually the offending piece of code looks like this:


(if (bufferp (get-file-buffer filename))
(setq found (buffer-file-name (get-file-buffer filename))))

The problem is that this always fails, and found will always be nil. The filename constructed is not being expanded, as get-file-buffer demands. However, expanding it is useless, since the exact expansion (absolute path) of the searched file is not exactly known! However, you can rework these lines to just look for a buffer whose name matches the file you are looking for:


(let ((b (find-if (lambda(x) (string= (buffer-name x) filename)) (buffer-list))))
(if b
(setq found (buffer-file-name b))))

Note that this will only do a simple string matching. It might happen that for a certain file foo.cc you have to buffers visiting some foo.h. The function will only find the first one. But in my opinion, there is not simple solution to find the semantically correct header file, anyway. So this is still better than the broken solution in Emacs.