Sunday, September 26, 2010

Ubuntu: Configuring Webcam and Microphone in Lenovo Y530

I have a Lenovo Y530 laptop. I had Windows then being the devoted Linux girl, I installed Ubuntu 9.10 on it. The laptop has built-in webcam(1.3M pixels). It was working fine with windows but got screwed up in ubuntu. So I set out to find out how to fix it. At first glance it looked like there was no proper solution available online. But after hours of search, I found the easy steps buried under a bunch of useless/complex solutions. So I wanted to document the exact steps I followed to configure the webcam.

  • I tried installing cheese(webcam booth tool for linux) and used Ekiga softphone. You can use either of this tool to check if the webcam is listed in video devices list. In Cheese, the screen had this test screen and both the tools din't recognize the webcam.
  • Then in Terminal, try "lsusb". It would list all the USB devices connected to the computer. A sample lsusb would look like this (this has no webcam)

    Bus 005 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 003: ID 046d:c016 Logitech, Inc. M-UV69a/HP M-UV96 Optical Wheel Mouse
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    The 8 digit number followed by ID is the unique ID of the hardware device. If at all you want to search for solutions for any device use this number in your searches and you will more likely land in the page you want. When I ran this cmd, the output din't have any device listed in it. Then in some thread in Ubuntu forums(an excellent place to start your search), someone asked to use hot keys to toggle the webcam. In Lenovo Y530, its Fn+Esc. After that, lsusb listed the device as in,
    Bus 002 Device 002: ID 04f2:b105 Chicony Electronics Co., Ltd
  • Now, I searched the ID with all related keywords, it landed here. I checked for my device and saw that it was complaint and all i have to do is download the v4l dvb drivers and viola.
  • Then follow the steps listed in this link. I downloaded the latest version of V4L/DVB via web browser and following cmds "make", "make install". [don't forget to do, "sudo make install" - I know its simple but trust me you don't want to miss it]
Then happened the weirdest thing. After rebooting the system and checking if webcam worked with cheese, the microphone got screwed. When open the sound preferences dialog(System->Preferences->Sound), in the Input tab, there was no device listed. Without proper knowledge about the thread flow, I removed pulseaudio from the system. Then it was a fresh start as with the webcam. The steps followed were the following:

  • In Terminal, use this cmd
    lspci -v | grep -i audio

    The result would print out the Audio device if configured right. In my case, it returned empty result.
  • So I downloaded the alsa drivers, util, lib files from here. Followed this steps
    • copy the tar.gz files to "/usr/src/alsa" - if you have the folder already or create one if you don't
    • Then unzip the files using "sudo tar xjf alsa-driver*". Similarly util and lib files(change tar options as you require)
    • Then we have to go each directory and do "./configure", "make", "make install".
    • During the "./configure" if any error pops, you have to clear that for the installation to complete. I am just listing the problems I faced.
      • Problem: During the "make" of Util files
         xmlto man alsactl_init.xml
        /bin/bash: xmlto: command not found

        Solution:
        sudo apt-get install xmlto
      • Problem: During the "./configure" of Util files
        checking for new_panel in -lpanelw... no
        configure: error: panelw library not found

        Solution: Create soft links to the library files. click here for source
         sudo ln -s libpanelw.so.5 /usr/lib/libpanelw.so
        sudo ln -s libformw.so.5 /usr/lib/libformw.so
        sudo ln -s libmenuw.so.5 /usr/lib/libmenuw.so
        sudo ln -s libncursesw.so.5 /lib/libncursesw.so

Then reboot the system. Now everything works perfectly fine.

Later added: As I mentioned in the post, I accidentally removed pulseaudio from my system. So when I tried to do skype call, both sides webcam worked fine. But audio had too much static noise. So I had to install pulseaudio. Then reinstalled skype. Skype call works fine. But still if I use the system's music player, then try skype calls again audio has static noise. I read from a forum that "sudo killall pulseaudio" and then restarting skype helps. But that is not efficient solution. If someone has permanent solution to this please drop a comment. Thanks in advance.

No comments: