fake's blog

everything fake

Keyword - code

Entries feed - Comments feed

PS3Eye GUID support for sysfs/udev

You've got a twin- or quad-PS3 Eye setup for a multitouch solution? On linux? Then you probably noticed there is no way to uniquely identify the cameras for persistant device names, if you change usb ports you're out of luck.

On windows, the CL-Eye SDK from codelaboratories has GUID support, which makes assigning the cameras in your code very reliable. On linux, the way to implement this would be udev rules.

I wrote a patch to expose the GUID and hardware version attributes of the cameras in sysfs. This required adding 2 hooks to the gspca framework, and implementing them in the ov534 driver file - i have no idea about the side effects this causes for the other gspca drivers, i don't have any other device to test this with. Also, i have never used sysfs before, and i didn't really test the usb sound stuff after my modifications, but for my use case it works perfectly. Be warned: use at your own risk.

Get the patch for kernel 2.6.35 - i use Ubuntu 10.10. Rough usage instructions, assuming you have your kernel source ready in /usr/src/linux

# patch -p1 < ~/ps3eye-guid-support_linux-2.6.35.patch
# make M=drivers/media/video/gspca
# cp drivers/media/video/gspca/*.ko /lib/modules/`uname -r`/kernel/drivers/media/video/gspca
# depmod -a

Then plug in the cam. The hardware version should be printed in the dmesg output, and /sys/classes/video4linux/video0/guid should show you the GUID of the cam. This can be used in ATTR{guid} - udev rules like this:

SUBSYSTEM=="video4linux", ACTION=="add", DRIVERS=="?*", ATTR{guid}=="123456-ABCD-DCBA-AAAA-BBCCDDEEFFAA", NAME="cam1"

This should create a device called cam1 for this (and only this!) camera.

Have fun!

openfire 3.6 and lotus domino/notes ldap

i just found the time to finally get the 3.6.4 openfire working with my company's notes ldap server again. here is the new patch to the sources, it's a -p1 (when in the untared openfire_src dir) unified diff.

one hunk of my old patch was merged it seems (though no one even commented on that post, hence the blog post this time), but additional fixing was necessary so the setup tool does disable DN enclosing by default, which breaks authentication in the case of lotus notes. the no-base-dn fix (which is in fact a workaround for the broken notes ldap, but i stopped argueing a while ago) is also updated.

after installation and setup, if your admin users were found and added but you're still unable to log in, you will need to set the following properties, either in your sql database or in the embedded database script file while openfire is stopped:

ldap.encloseDNs = false
ldap.encloseGroupDN = false
ldap.encloseUserDN = false

That way, the DN enclosing will also be switched off after installation. Start up openfire and you're good to go.

Another property of interest for lotus domino ldap users is "ldap.override.avatar", it will enable the display and transmission of user icons. yay... technology just can't be stopped ;-)

one-liner for changing file endings

i have not been blogging for quite some time, i noticed when replacing the blog software; so now i keep constantly thinking about what i may blog, so a little more density in the posts evolves ;-)

here's today's note; i just needed it and figured someone might say "aaw! that's useful" - a one-liner to use in bash for changing the extension of given files in a directory. bash is the shell that is by default installed in mac os x, and opens when you start the "Terminal" application. It is also the default in almost all linux distributions.

in this example, i rename all .mp4 files to .m4v (thanks, ps3...). adapt as needed.
for i in *.mp4 ; do mv "$i" "${i%%mp4}m4v" ; done
the %% operator strips the string following it from the end of the variable's content. the ## operator does the same, but at the beginning of the string.

GPIO to I2C on a Soekris net4801

I recently started playing around with robots from arexx - a friend introduced me to the asuro, and - impressed by the steep learning curve - i got myself an RP6.

having toyed around with it, i remembered i had an old soekris net4801 lying around... which, unfortunately, does not have i2c ports pinned out - but it has 12 GPIO pins ... i quickly found i2c-gpio in the linux kernel, but that uses the arch-independent gpio layer called gpiolib. the soekris pc8736x gpio driver does not support this layer :(

i'm by far not a kernel developer, but i managed to insert a small wrapping layer that seems to work. it basically registers the pc8736x as generic gpio chip, additionally to the character device(s).

i repeat: i am not a kernel developer. this is a hack so ugly it will most likely not work for you. if you have a soekris net4801 (no, a net4501 will not work! it has lesser gpio pins! go count!) your chances are indefinitely higher it may work, but i don't guarantee anything. also, even the most basic cleanup code is missing - i am not removing the gpio chip on unload, i just dont' care for now.

included in the patch below is a i2c-gpio-generic module i found in the openwrt subversion by pure coincidence, it works very well. i just patched it so it hardcodes sda and scl to open drain, which is the default on the soekris.

to get i2c up and running on the gpio pins 0 and 1 (jp5 pins 3 and 4 on the connector!) with 0 being sda and 1 being scl, you have to

  • modprobe pc8736x_gpio
  • read dmesg and note the assigned lowest pin nr (244 for me)
  • modprobe i2c-generic-custom bus0=245,244,245 (the latter two being the number from above 1st, and 1 added to it 2nd. the first nr. is the i2c bus id. choose it to your liking.)
  • modprobe i2c-dev
that should enable you to run i2cdetect on the newly appeared bus.

a little warning: i wouldn't mess around with the character device while using this, especially not for the pins in use for i2c. you have been warned.

i also wrote a small test program that reads out the current light sensor value (left) of the rp6 running the IC2_Slave example program that it has been shipped with.

also, the *actual* pinout-to-minor-device-nr for the gpio character device might be of interest here:

SoekrisPC8736xMinor Device #
GPIO 0GPIO 20, 11716
GPIO 1GPIO 21, 11817
GPIO 2GPIO 22, 11918
GPIO 3GPIO 23, 12019
GPIO 4GPIO 24, 12120
GPIO 5GPIO 24, 12221
GPIO 6GPIO 26, 12322
GPIO 7GPIO 26, 12423
GPIO 8GPIO 4, 64
GPIO 9GPIO 5, 75
GPIO 10GPIO 13, 5511
GPIO 11GPIO 12, 5410

kudos to the guy who found this out, it cost me 2 days to figure out the straightforward approach (GPIO 20 = minor 20?) was wrong.

here is the patch. handle with care. it's against linux- i used this .config to build the kernel.

exportPB4Fritz updated

i just updated the exportPB4Fritz.py skript so it can handle contacts that do not have a first, but a lastname set. a minor fix, of course, just thought i'd quickly replace the version from the original posting so people not into python can use it with "interesting" os x address books ;-) the download url is the same, it's in the blog post linked above.

- page 1 of 3