fake's blog

everything fake

72 Stunden Countdown für #Zensursula - ePetition

the following blog post is german, because once again it covers a german politics topic. please ask me to translate it by commenting or use the google translator if you need to know ;-)

am mittwoch findet vormittags eine oeffentliche anhoerung zu den internet-sperren statt.

ziel der aktion von netzpolitik.org ist es, bis dahin die 100.000er-grenze bei den mitzeichnern als argumentationsgrundlage und deutliches signal mindestens zu knacken. daher moechte ich euch auch ermutigen, noch einmal alle leute in eurem bekanntenkreis zu nerven, ob sie schon mitgezeichnet haben, und die thematik gegebenenfalls zu erklaeren, damit sie sich eine meinung bilden koennen.

es gibt da ein nettes video von c't-tv, das ich schamlos von brians blog entwendet habe, und die thematik sehr fein zusammenfasst.

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.

Graphing Desktop Backgrounds

Math, me bored, wildly typing whatever the guy upfront is talking about into Grapher.app, and oh, look, my new desktop background ;-)

the formula is sin^2(x), scaled up and down a bit.

sinsquarex_tn.png
PNG Bitmap Version | PDF Vector Graphic

got any better stuff i can still understand the math behind? ;-)

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-2.6.27.6. 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 2 of 12 -