Random Noise

cat /dev/random >> /dev/dsp

Archive for the ‘gentoo’ Category

Asus G1S-A1 1.3M Pixel webcam adventure

with 3 comments

I use gentoo linux on my laptop (G1S-A1). Everything is working including wireless, bluetooth, media keys etc.
The only thing that annoys me is when I use skype beta (with video) or any other webcam utility. The webcam image is 180° inverted!! I know it sounds funny..but its annoying after a while… Anyway, as usual I set out on the quest 😀 to find out the cause and possible remedy. A quick lsusb gives tells me that the device id and vendor id information.

localhost ~# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 007 Device 002: ID 0b05:1712 ASUSTek Computer, Inc.
Bus 007 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 002: ID 046d:c521 Logitech, Inc.
Bus 005 Device 001: ID 0000:0000
Bus 001 Device 003: ID 0b05:1726 ASUSTek Computer, Inc.
Bus 001 Device 002: ID 174f:5a35
Bus 001 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000

To get more information about the webcam from vendor/device id

localhost ~ # lsusb -v -d 174f:5a35

iManufacturer 2 Sonix Technology Co., Ltd.
iProduct 1 USB 2.0 Camera

I tried to google the combination of device id and sonix to find any information about the camera. But it turned out that there is no such device manufactured/assembled by Sonix. I was curious and I thought lets see what the windows driver for this webcam has to say. I rebooted into Vista and bingo! the device information clearly mentions D-Max/Sonix 1.3M pixel camera. All the description regarding their camera modules can be found their website. Two weeks ago I was able to find the module along with device id mentioned. Unfortunately today I’m unable to locate the 5A35 module on that page because all the camera modules have generic names now(e.g 1.3M_UVC 5). I couldn’t find any cached page on google either. Looks like they D-Max doesn’t want to disclose that information.

On further digging through windows driver files, snp2uvc.inf (version 04/18/2007, reveals some cool information.

%SN.USBVideo.DeviceDesc% = SN.USBVideo.XP,USB\VID_174f&PID_5a35 ;GD-5A35A(Ov9655)
%SN.USBVideo.DeviceDesc% = SN.USBVideo.XP,USB\VID_174f&PID_5a31 ;GD-5A31A(MI1320)
%SN.USBVideo2M.DeviceDesc% = SN.USBVideo2M.XP,USB\VID_174f&PID_5a51 ;GD-5A51A
%SN.USBVideoVGA.DeviceDesc% = SN.USBVideoVGA.XP,USB\VID_174f&PID_5a11 ;GD-5A11A(Ov7670)

Hmm…After searching for GD-5A35A I found this cached link that links 5A35 to the generic model number that is 1.3M_UVC 1. So, here are the specifications:

1.3M_UVC 1 USB 2.0 1.3MP Camera Module Support UVC


• SXGA Resolution Image Sensor
•Video Resolution:
1280 x 1024, 1280 x 800
1204 x 768, 800 x 600
640 x 480, 352 x 288
320 x 240.
•Frame Rate:
640 x 480 at 30fps maximum
1280 x 1024 at 8fps maximum
•Video Format: YUY2
•LED Indicator
•DOF on 30~80cm
•Support UVC
•Auto Exposure
•Auto White Balance Control
•High Speed USB 2.0 Interface
•Low Power Consumption
•RoHS Compliant
•Dimension(LxWxH) 60 x 8.5 x 7.05mm

On careful inspection of snp2uvc.inf you can see that my webcam uses OV9655 sensor – cool! And the datasheet for that can be found here: http://rapidshare.com/files/94672360/OV9655-datasheet.pdf.html

Interestingly the newer version of the webcam driver doesn’t specify the sensor (OV9655) or the model number (GD-5A35A) information.

Most of the datasheet information went over my head except some interesting bits.
If you skip to “Register Set” and checkout register 1E :

1E MVFP 00 RW  Mirror / Vertical Flip Enable                

Bit[7:6] Reserved                
Bit[5]   Mirror                  
    0: Normal Image                  
    1: Mirror Image                
Bit[4]   Vertical Flip                  
    0: Vertical Flip Disable                  
    1: Vertical Flip Enable                
Bit[3:0] Reserved

Default value for bit[4] is 0, i.e VFlip is disabled. We get upside down image which means that the webcam module is installed upside down on G1S-A1, so the linux uvc driver must find a way to set the bit[4] of this register.

I’m reading through uvc-linux source to understand the driver and make appropriate changes. But it can take sometime… Sole purpose of this blog entry is to inform you guys about my findings, so someone with the right knowledge can add the vflip support for this webcam.

Written by Vivek Unune

February 24, 2008 at 11:08 pm

Better UI and fonts in linux – I

leave a comment »

So you want to have your linux GUI to look uber cool huh?

Remember last time when you installed linux on your home PC? If you are like me, probably you spent atleast a week before you feel comfortable with the settings and customizations. You make sure that all the required tools and applications installed. Like Firefox, OpenOffice, Mplayer and so on. But, no matter what you do linux GUI dosen’t look consistent! All the apps don’t use same fonts, font-sizes. The UI components look different for different apps etc. Probably you know the reason: All the applications in linux use different GUI toolkits. The two most commonly used toolkits are GTK and QT. So, what? Well they rely on different redering techniques unique to the toolkit. This gap between the two can be bridged by installing GTK-Qt Theme Engine.”The GTK-Qt Theme Engine is a plug-in for GTK that allows GTK applications to use Qt widget styles.”

Most of the Linux distros have GTK-Qt Theme Engine available as a package.
Install it :

Gentoo: emerge x11-themes/gtk-engines-qt
Ubuntu: apt-get install gtk-qt-engine
Fedora: yum install gtk-qt-engine

Once you done with that. Use it from KDE control center.
Find a screenshot from my Gentoo machine here.
Now it’s time to fix the fonts. The rendering of the fonts depends on following things:

  1. Screen Size (17″, 19″, 20″ etc.)
  2. Screen Resolution (1024×768, 1280×1024, 1680×1050 etc.)
  3. Dots per Inch or DPI in short (http://en.wikipedia.org/wiki/Dots_per_inch)
  4. Freetype’s Byte Code Interpreter switch
  5. Sub Pixel Rendering (http://en.wikipedia.org/wiki/Subpixel_rendering)
  6. Font Hinting

Dots per pixel:
“Dots per inch (DPI) is a measure of printing resolution, in particular the number of individual dots of ink a printer or toner can produce within a linear one-inch (2.54 cm) space.”. Modern monitors support DPI = 96×96 or sometimes more. Though 96×96 is enough to get good quality fonts.

The screen size, screen resolution and the DPI all are related by the following equation:
For monitor width in millimeters to achieve DPI of 96:

x = (25.4 x resolution width in pixels)/96

Same for monitor height in millimeters:

y = (25.4 x resolution height in pixels)/96

Do I need the above x and y values?
If you have NVidia graphics card, you don’t have to do the above calculation. You can tell the nvidia driver to calculate it for you.For this specify the following in /etc/X11/xorg.conf under device section:

Section “Device”

Driver “nvidia”

Option “UseEdidDpi” “FALSE” #
Option “DPI” “96 x 96” # specify these two lines

End Section

If you have an ATI graphics card, the graphics drivers sucks. So we have to tell it what to use. For example you have monitor with native max resolution 1280 x 1024:

(25.4 x 1280)/96 = 338.6
(25.4 x 1024)/96 = 270.9

For this specify the following in /etc/X11/xorg.conf under monitor section:

Section “Monitor”

DisplaySize 338.6 270.9

End Section

After this restart your X. press Ctrl + Alt + F1, then if promted enter login info and enter following command:

/etc/init.d/xdm restart

In the next part, I’ll will continue with beautifying fonts in linux.

Written by Vivek Unune

July 7, 2007 at 1:01 am

Posted in gentoo, linux

Tagged with , , , , ,