Logitech, Inc. Webcam C270 on Raspberry Pi

Just a small note. I tried to get my Logitech, Inc. Webcam C270 running on an raspberry pi v1 running raspbian wheezy and ran into some problems.

The webcam can be used on linux with the uvcvideo kernel module but using uvccapture did not work for me.

$ dmesg
uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
input: UVC Camera (046d:0825) as /devices/.../input/input0
usbcore: registered new interface driver uvcvideo

Running uvccapture:

$ uvccapture
ERROR opening V4L interface
: No such file or directory

Mplayer didn’t work either with various settings – producing green only images.

mplayer tv:// -tv driver=v4l2:device=/dev/video0 -vo png -frames 1

Then I found out there is a limited set of formats your camera can deliver and how to display:

$  v4l2-ctl --list-formats -d /dev/video0
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUV 4:2:2 (YUYV)

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : MJPEG

Seems like I can capture images in YUYV Format and MJPEG directly. This led me to vgrabbj which seems to be a highly flexible image grabber. The following command works for me:

$  vgrabbj -q 100 -i vga -o jpg -f /tmp/snap.jpg -e -d /dev/video0

So, give vgrabbj a try.

How to install oracle java 7 update 11 (jdk-7u11) on debian linux

Currently you can’t install the new java sdk 7 update 11 from oracle using java_package. Usually you can simply follow this instruction: Installing oracle jre / sdk on debian.

Unfortunately the error is: No matching plugin was found.

But you can modify the script /usr/share/java-package/oracle-j2sdk.sh to accept the new package:

<       "jdk-7u"[0-9]"-linux-i586.tar.gz") # SUPPORTED
<           j2se_version=1.7.0+update${archive_name:6:1}${revision}
>       "jdk-7u"[0-9][0-9]"-linux-i586.tar.gz") # SUPPORTED
>           j2se_version=1.7.0+update${archive_name:6:2}${revision}
<       "jdk-7u"[0-9]"-linux-x64.tar.gz") # SUPPORTED
<           j2se_version=1.7.0+update${archive_name:6:1}${revision}
>       "jdk-7u"[0-9][0-9]"-linux-x64.tar.gz") # SUPPORTED
>           j2se_version=1.7.0+update${archive_name:6:2}${revision}

Worked for me:

The Debian package has been created in the current directory. You can
install the package as root (e.g. dpkg -i oracle-j2sdk1.7_1.7.0+update11_amd64.deb).

(#:/tmp)- dpkg -i oracle-j2sdk1.7_1.7.0+update11_amd64.deb
(Reading database … 225711 files and directories currently installed.)
Preparing to replace oracle-j2sdk1.7 1.7.0+update7 (using oracle-j2sdk1.7_1.7.0+update11_amd64.deb) …
Unpacking replacement oracle-j2sdk1.7 …
Setting up oracle-j2sdk1.7 (1.7.0+update11) …

(#:/tmp)- java -version
java version „1.7.0_11“
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

There is also a bug report: Bug#698108: jdk7u11 not supported

Edit: also works for java 7 update 12 (jdk-7u12), java 7 update 13 (jdk-7u13), java 7 update 14 (jdk-7u14) and java 7 update 15 (jdk-7u15)

Edit: Oh boy, too many updates recently.

Short howto: Smartd with mail notification to remote address

This guide is for debian squeeze

SMART is a nice mechanism to detect hard disc drive problems early. There is a daemon that sends user mails in order to notify you. But for normal desktops machines you usually don’t have your mail server set up properly so you can only receive local mails.

They can be read using the terminal command „mail“, but using your graphical user interface you won’t notice them in time.

Therefore I was searching for a way to send them to my normal account „xy@arcor.de“. To make this happen, the local command "echo "hello" | mail xy@arcor.de -s 'testmail'" has to work.

I found some tutorials about how to set up exim 4 to use a smarthost to forward all mails to. But unfortunately this didn’t work with my provider arcor.de, they don’t seem to like it for spamming reasons. Luckily google has less of a problem with that, I guess they are just happy to be able to read the mails too …

I followed the great tutorial http://wiki.debian.org/GmailAndExim4 on how set up gmail as smarthost. Important was here to use my local (unofficial) domain jet.bebop as it is configured on the local machine. This way exim can detect if the mail is supposed to go to localhost and does not involve google when just sending mail to „root“.

Testing after following the howto:

$ echo „Hello“ | mail xy@arcor.de -s „Testing“

$ tail /var/log/exim4/mainlog
2011-02-13 14:03:35 1Pobbz-0003bM-E4 xy@arcor.de R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [] X=TLS1.0:RSA_ARCFOUR_SHA1:16 DN=“C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com“
2011-02-13 14:03:38 1Pobbz-0003bM-E4 Completed

And I got mail.

Moving on to the second part, setting up smart, which is quite easy on debian.

I just installed smartmontools and enabled the smartd in the default configs.

$ cat /etc/default/smartmontools
# Defaults for smartmontools initscript (/etc/init.d/smartmontools)
# This is a POSIX shell fragment

# List of devices you want to explicitly enable S.M.A.R.T. for
# Not needed (and not recommended) if the device is monitored by smartd
#enable_smart=“/dev/hda /dev/hdb“

# uncomment to start smartd on system startup

# uncomment to pass additional options to smartd on startup

By default, smartd uses all drives in your system which is what I want. The config file is imho very verbose and can be modified to your needs. Important is to change the -m xy@arcor.de part to the desired mail address.

$vim /etc/smartd.conf

DEVICESCAN -d removable -n standby -m xy@arcor.de -M exec /usr/share/smartmontools/smartd-runner

After reloading smart, everything should be set up and ready.

$ /etc/init.d/smartmontools reload
Reloading S.M.A.R.T. daemon: smartd.

But you can also test if the smart daemon can send mails to you by the following procedure just to sure:

Create a temporary config file just for the purpose of testing the mail delivery. -M test will make the daemon send an initial test notification, /dev/sdb can just be any drive on your system:

$ echo „/dev/sdb -m xy@arcor.de -M test“ > /etc/smartd.conf.test
$ smartd -c /etc/smartd.conf.test

You should receive a mail like this:

This email was generated by the smartd daemon running on:

host name: jet
DNS domain: bebop
NIS domain: (none)

The following warning/error was logged by the smartd daemon:

TEST EMAIL from smartd for device: /dev/sdb [SAT]

For details see host’s SYSLOG (default: /var/log/syslog).

You can now kill that test daemon and sleep well with your smart monitored discs.

apt-get -b source

Nun nutze ich debian schon ca. 5 Jahre und wurde gestern doch wieder einmal völlig neu beeindruckt.

Mein Problem war einfach: Ich wollte ein Programm schreiben das global alle Keyboard Events behandelt. So etwas ist praktisch für Shortcuts oder so selbstverständlichen Dingen wie Push to Talk im Voice Chat Programmen.

Da X das von Haus aus nicht vorsieht, da dies durchaus ein nachvollziehbares Sicherheitsrisiko darstellt, wenn man hierbei z.B. an Keylogger denkt.

Dennoch gibt es Abhilfe in Form von XEvIE http://freedesktop.org/wiki/Software/XEvIE. Das klingt nun genau nach dem was ich gesucht habe. Doch nachdem die Extension im X-Server installiert war ging das Beispielprogramm immer noch nicht, was nicht zuletzt daran liegt dass das Projekt leider verwaist ist.

Glücklicherweise habe ich von rE in #linux-clan @ quakenet einen Tipp bekommen. http://bugs.freedesktop.org/show_bug.cgi?id=17394 ein paar kleinen Codeänderungen sollten der Schlüssel zum funktionierenden XEvIE sein. Es trennte mich nur noch das Kompilieren eines eigenen X-Servers vom Glück. Ohje …

Aber. Alles halb so schlimm, debian verfügt über eine klasse Sourceverwaltung die es mit wenigen Befehlen ermöglicht die vorhandenen debian Pakete selber zu bauen und beliebige Änderungen vorzunehmen. Weitere Infos dazu gibt es hier http://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.en.html. Das Installieren ist so einfach wie es nur geht, einfach das selbst gebaute Paket mit dpkg -i ausführen und das original wird ersetzt.

$ ./xevidemo
Delay is 0 milliseconds
major = 1, minor = 0
XevieStart(dpy) finished
(   0) KeyRelease
(   1) KeyPress
        State: 0 KeyCode: 26
        Char Count: 1 KeySym: 61 char: |a|
(   2) KeyRelease
(   3) KeyPress
        State: 0 KeyCode: 28
        Char Count: 1 KeySym: 64 char: |d|

Edit 2008-09-29:
Herrlich, heute kam das xserver-xorg-core update mit dem XEvIE fix integriert. Nun gut, immerhin haben wir was gelernt!