Sunday, October 3, 2010

Fix for upside down laptop camera in Skype under Linux

If you're unlucky to have a laptop with built in upside-down camera, and you're tired of looking like a bat:

You need to install 32-bit libv4l1compat (or something similar) and launch Skype like this:
LIBV4LCONTROL_FLAGS=1 LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

If it does not work, you can try using 2 and 3 instead. Note: if when you run it complains about being unable to preload v4l1compat.so , make sure you have it. You may have it in a different place, e.g. under lib32.

In the gnome main menu, or application launcher, or the like, you should use
bash -c "LIBV4LCONTROL_FLAGS=1 LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype"

as the command.

Earlier fix: My girlfriend was flipping her display upside down with the video driver settings, to see me upside up. She's this awesome.
It took me a while to fish out this single command line from the sea of fixes that do not work for me, or shitty fixes such as hacking the driver to do image manipulation in the kernel LOL*.

My hardware: ASUS K61IC laptop.
The webcam USB device is listed as
Bus 001 Device 002: ID 064e:a116 Suyin Corp.
and it is reported elsewhere as
USB2.0 UVC 1.3M WebCam

The fix may work for other cams as well.

Other VERY useful webcam tool: v4l2ucp . It allows you to adjust the actual camera parameters such as gain. Those control the camera chip - they may actually be controlling the sensor settings itself - something that you cannot replicate in software afterwards.



I just cannot end a post without a little rant how something suck.
*Doing such stuff in a driver is a big no-no for monolithic kernel where drivers are run as part of kernel and any screw-up in the driver code brings entire system down. I'm with Tanenbaum. With a well designed microkernel, you do not care what the driver does, you can safely use complicated algorithms within the driver (such as decoding compressed images sent by camera) - and the kernel developers don't have to reject your code on the grounds of potential stability compromise. It's kind of bad that Linux has all the spotlight, and all the development - it is by far not the best open source kernel design around.

2 comments:

  1. Thank you very very much. I spend all day around LD_PRELOAD=... skype, which cannot be preloaded. But now I used 'LIBV4LCONTROL_FLAGS=2 LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype'. It works finally!

    ReplyDelete
  2. Thanks commenter! This finally worked!

    I had to use the following command to run skype with webcam correctly aligned:

    LIBV4LCONTROL_FLAGS=2 LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

    ReplyDelete