May 31
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

Update, 17/08/08: There is no longer any need to switch to the Experimental branch, if you are using the following Microdia cameras:

0c45:6027, 0c45:608f, 0c45:60ec, 0c45:60fe, 0c45:60c0, 0c45:613b, 0c45:613c, 0c45:624e, 0c45:624f, 0c45:6242, 0c45:6253, 0c45:6260, 0c45:6270, 0c45:627b, 0c45:8105

Keep up to date on the current supported webcams: http://groups.google.com/group/microdia/web/project-status?hl=en

The webcam (Acer Orbicam) on my Acer Aspire 5052 has been somewhat of a bane - with no drivers available, it has been one of the last stumbling blocks of getting all of my hardware working in Linux (the Ubuntu 8.04 Distro, Hardy Heron, in my case). That is until I ambled across, quite by accident, the Microdia Google Group. These guys are the epitome of Open Source development in action - a group of widely distributed people who are collaborating to solve a common problem: to get the Microdia webcams supported under Linux. And they’re doing a fantastic job so far.

Note: I should first mention that the drivers are still heavily under development, and although they are not (for some webcams) to the point where they can be used for Skype, for example, major progress has been made, and there is now finally communication with my webcam, to the point where I can successfully output video to mplayer. Therefore, this post is not quite yet a HowTo on getting a Microdia webcam fully function, but a step towards helping people installing and testing the drivers under development.

So, here’s how I’ve got to the stage of seeing myself in mplayer…

Information Gathering

Note: this section is only relevant if you’re interested in the workings of the camera, or would like to aid the driver developers by supplying information about your webcam. If you just want to compile and install the drivers, scroll down to Driver Compiling and Installing.

Firstly, I had to determine i) whether or not my Webcam was in fact a Microdia camera, and ii) the model number, so in a Terminan, I ran:

lsusb

Which output, amongst other information about the rest of my USB devices:

Bus 003 Device 002: ID 0c45:6260 Microdia

confirming that my Acer Orbicam is a Microdia device. The two hex values 0c45:6260 represent the Vendor ID and Product ID respectively - 0c45 being Microdia, and 6260 the Product itself. In order to create my meagre contribution to the Microdia Group, I had to gather some more information about the device’s bridge and sensor. Firstly, I needed the USB Device Descriptors, which were obtained by running:

sudo lsusb -d 0c45:6260 -v > ~/Desktop/0c45_6260_device_descriptors.txt

I then needed to discover the Bridge and Sensor types, which thankfully could be found in the Windows driver file, snp2std.inf:

%USBPCamDesc% = SN.USBPCamVGA,USB\VID_0c45&PID_6260 ; SN9C201 + OV7670ISP

Which tells me:
Bridge: SN9C201
Sensor: OV7670

The full guide to gathering information for your webcam can be found at the Microdia group, here.

Driver Compiling and Installing

The driver code is controlled by git, which I installed by running:

sudo apt-get install git-core gitk git-gui git-doc curl

Also, before downloading and installing the drivers, I ran:

sudo apt-get install kernel-package linux-source build-essential

To grab the Linux source etc. Once finished, I created a directory to set up my local git repository and downloaded the driver code:

cd ~/Documents
mkdir webcam
cd webcam
git clone http://repo.or.cz/r/microdia.git

The final command executes git, and tells it to clone the remote repository. The files are downloaded to a sub directory called microdia, from which I ran the rest of the commands:

cd microdia

Note: If you have any of the following Microdia cameras, you’ll need to switch to the Experimental branch:

6242, 624e, 624f, 6270, 627b, 62bb, 145f:013d, 045e:00f4

Switch to the Experimental branch by running:

git checkout --track -b v4l2-experimental origin/v4l2-experimental

I then compiled the code:

make

and received this error, but it’s not important:

make: ctags: Command not found
make: *** [ctags] Error 127

Once compiled, the module can be inserted to the kernel for testing:

sudo insmod ./microdia.ko

I also received the following error:

insmod: error inserting ‘microdia.ko’: -1 Unknown symbol in module

so had to run the following first:

sudo modprobe videodev
sudo modprobe compat-ioctl32

and then I could insert the module:

sudo insmod ./microdia.ko

Finally, to test, I ran:

mplayer tv:// -tv noaudio:driver=v4l2:width=640:height=480:outfmt=yuy2:device=/dev/video0:fps=30

you may need to change /dev/video0 to /dev/video1 - also, if you don’t have mplayer, it needs installing:

sudo apt-get install mplayer

The only thing is… it’s currently a mirror image, hehehe:

Finally…

If everything looks good, and the camera works well, it can be installed permanently by running the following:

strip -g microdia.ko
sudo cp microdia.ko /lib/modules/`uname -r`/kernel/drivers/media/video/usbvideo/
sudo depmod -a

However, only do this if you are comfortable with the driver, and happy that it is stable on your system!

References

  1. Microdia, Google Group
  2. Full list of currently supported (and unsupported) Microdia Webcams
  3. How to gather information on your webcam
  4. Using git with Microdia
  5. Testing the Microdia driver
  6. PATCH: v4l-experimental support for 6260 (3rd try) Thread

written by Hodge \\ tags: , , ,

May 25
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

CHM IconAs most people know, CHM (Microsoft Compiled HTML Help) is a proprietary format, and not supported by default in Linux. Thankfully, there are several options available for viewing CHM files, and even converting them to another format - such as HTML and PDF.

Viewing CHM Files

The simplest method for dealing with CHM files is to download and install a CHM Viewer, for example gnochm or xchm, which under Ubuntu/Debian can be installed via a Terminal:

sudo apt-get install gnochm

or

sudo apt-get install xchm

or via the Synaptic Package Manager, by searching for “gnochm”, or “xchm”. Once installed, CHM files will automatically open within the CHM Viewer.

Converting CHM Files

My prefered method for dealing with CHM files, is to convert them to a more universal format, such as HTML, or even PDF, and there are a couple of ways, and several different tools for accomplishing this.

Conversion Method 1: CHM -> HTML (-> PDF)

HTML IconFirstly, it is possible to simply decompile the CHM file into component HTML files, which can be opened in any web browser. These HTML files may then optionally be transformed into a PDF document. In order to do this, two main packages (with dependencies) need to be installed - chmlib, and htmldoc:

sudo apt-get install libchm-bin htmldoc

The first part of the process calls upon chmlib to essentially decompile the CHM file, and save the new files to a specified directory, for example:

extract_chmLib my_chm_book.chm htmloutputdir

This will pull apart the CHM file, and store all the new HTML files within the “htmloutputdir” directory (within a sub-directory called “final”). If desired, htmldoc can be called upon to convert the HTML files into a single PDF document. Running

htmldoc &

from the Terminal, opens up the htmldoc GUI from which the HTML files can be selected for input, the output formatted, and PDF document generated. The htmldoc website has extensive documentation which covers this process, but for converting to PDF, I find the next method much easier!

Conversion Method 2: CHM -> PDF

PDF IconA tool written in Python, called chm2pdf, essentially cuts out (for the user) the intermediary processes above. It sits as a layer on top of chmlib and htmldoc, automating most of the conversion work, and as such also requires chmlib, htmldoc and additionally pychm (Python binding for chmlib) in order to execute. chm2pdf can be downloaded from the website and compiled/installed manually or, in Ubuntu, installed from the repositories. To install it, and the required additional applications, in a terminal run:

sudo apt-get install libchm-bin htmldoc python-chm chm2pdf

chm2pdf is a command line tool, and in most cases, the default options work for me (outputting an A4 PDF document, with ToC, images, links etc.), and is as simple as running:

chm2pdf --webpage my_chm_book.chm

from the directory where the CHM file is located. This converts the file (to HTML - these files are stored in the /tmp directory), and generates a PDF document with the same name, with the ToC, Index, links, images etc. all intact. Running either:

man chm2pdf

or

chm2pdf --help | less

will output the manual and help pages, both of which contain a wealth of information and command options to perfect and tweak the CHM to PDF conversion process.

written by Hodge \\ tags: , , ,

May 21
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

While aimlessly wandering the web yesterday, I happened upon a rather cool little plugin for Eclipse, called AnyEdit tools, which adds a bunch of useful tools to the context menu of the Eclipse editor, and also to the output consoles, main menu and editor toolbar. Most interestingly for me, is the addition to the context menu which allows opening an included file from the within Editor, which means I don’t have to search through directory structures in the Eclipse explorer to open a file included in the one I’m currently editing. With AnyEdit tools, I just right-click on the include/require statement, and select “Open file under cursor” (Ctrl+Alt+R does the same), and the file is opened in the editor. Cool.

AnyEdit tools is easy to install - in Eclipse, go to Help -> Software Updates -> Find and Install and select the “Search for ne features to install” option. Click on “New Remote Site”, and add “AnyEdit tools” as the Name, and http://andrei.gmxhome.de/eclipse/ as the URL and click OK. Tick the box next to the new site, and click Finish. Once the update site has been contacted, and the plugin list retrieved, expand the AnyEdit tools -> Eclipse 3.3 plugins, and select AnyEditTools 2.0.2. Click Next, accept the agreement, Next, Next, Finish. Once dowloaded, the Update Manager asks to verify the installation - click Install, and that’s it. Eclipse needs restarting to activate the plugin.

written by Hodge \\ tags: ,

May 14
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 2 out of 5)
Loading ... Loading ...

I’ve just solved a funky little problem with Compiz and Emerald, whereby Emerald wasn’t used for window decorations, and changing the Theme via the Emerald Theme Manager accomplished nothing - this is after upgrading to Ubuntu Hardy Heron, by the way. If you don’t have Emerald installed, it can be done by running, in a Terminal:

sudo apt-get install emerald

or via the Synaptic Package Manager. The same goes for the CompizConfig Settings Manager:

apt-get install compizconfig-settings-manager

Anyway, the problem boiled down to Compiz not using Emerald for Window Decoration, and was thankfully veyr easy to solve, by pointing Compiz to the Emerald binary. Open up the compizConfig Settings Manager - System -> Preferences -> Advanced Desktop Effects Settings and select the “Effects” category from the left menu. Click on “Window Decoration” from the selectionin the right pane, and for Command, enter:

/usr/bin/emerald

Make sure it’s enabled, and close the CompizConfig Settings Manager. In order for the new settings to take effect, wither restart X by pressing Ctrl+Alt+Backspace, or run the following in a Terminal:

compiz --replace &
emerald --replace &

Now Compiz is using Emerald for my Window Decorations, and I can once again change the Emerald Theme dynamically via the Emerald Theme Manager.

written by Hodge \\ tags: ,

May 13
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4 out of 5)
Loading ... Loading ...

There are times - many in fact - when I need to find a file, or multiple files containing a particular string. For example, I’m developing a web application, and need to find out which pages call a particular class method, say, all the files which call the getTopTenCDs() method - I can do this by opening a Terminal, and running grep (Global Regular Expression Print), with a couple of options:

grep -r -n 'getTopTenCDs()' /var/www/cdcollection/*

This will return a list of files, and the lines within those files, and the line numbers containing the string ‘getTopTenCDs()’ in the directory /var/www/cdcollection/. The -n option tells grep to output the line numbers, the -r option tells grep to search recursively through the sub-directories too, and * tells it to look in all files - which can be changed to *.php etc: /var/www/cdcollection/*.php

So, the output would be something along the lines of:

/var/www/cdcollection/viewcd.php:192:   $topTen = $cd->getTopTenCDs();
/var/www/cdcollection/sidebar.php:215:   $topTen = $cd->getTopTenCDs();

If I just want a list of files without the lines containing the search string, I can use the -l option:

grep -r -l 'getTopTenCDs()' /var/www/cdcollection/*

which would simply return:

/var/www/cdcollection/viewcd.php
/var/www/cdcollection/sidebar.php

As the name implies, grep uses Regular Expressions, and therefore the search string can contain the usual RegEx operatiors: . ? * + {n} etc. RegEx is out of scope for this post I’m affraid - there are dozens of great tutorials available on RegEx, and applying RegEx to grep.

One final point about grep: if the search string begins with a hyphen (minus sign, or whatever you want to call “-”), the search string needs to be preceded with the -e option:

grep -r -e '-starts with a hyphen' /var/www/cdcollection/*

so that grep doesn’t mistake the search pattern for an option! Forget the -e option, and you’ll get:

grep: invalid option -- $
Usage: grep [OPTION]… PATTERN [FILE]…
Try `grep –help’ for more information.

Also, remember the ever useful pipe | and output to file > commands. If the list printed by grep is huge, you can simply pipe it to more:

grep -r 'getTopTenCDs()' /var/www/cdcollection/* | more

or, if you want to save it to a file to peruse later:

grep -r 'getTopTenCDs()' /var/www/cdcollection/* > ~/grep_output.txt

Always useful.

Finally, remember to take a look at the grep man page:

man grep

Which contains a world of useful information, including a wealth of options I haven’t covered.

written by Hodge \\ tags: , , ,

May 12
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Skype. Skype, skype, skype… Say it enough times, and it sounds like a nonsensical sound. Mind you, say any word repeatedly, enough times, and it ceases to sound like a real word and becomes gibberish, randomly rolling between toungue and palate like a peanut in a tin can. Try it. “Flannel” is a great word to experiment with, although after 30 seconds of repeating it, you’ll probably question your sanity…

But anyway, this post isn’t about language, it’s about how I got Skype installed, and customized the look and feel of the GUI. I’ll not bore you with the details on what Skype is, and what it does - most people know already, and most likely found this page by searching for “Installing Skype on 64 Bit Ubunutu”, or some such string. If not, you can check out the Skype website.

First things first - as of writing this post, there is no 64 Bit version of Skype available for Linux. Thankfully, it is possible to install 32 Bit applications in 64 Bit Ubuntu with the correct libraries:

sudo apt-get install ia32-libs

ia32-libs is available through the Universe repositories, which can be activated by going to System -> Administration -> Software Sources and checking the “Universe” option.

Having installed the correct libraries, I downloaded the deb package (generic download page here), and saved it to my Desktop. Since it is a 32 bit application, dpkg requires prodding with the –force-architecture and –force-depends options:

cd ~/Desktop
sudo dpkg --install --force-architecture --force-depends skype-debian_2.0.0.68-1_i386.deb

(The current version is 2.0.0.68-1 - if you have downloaded a later version, you’ll need to replace the version number in the file name with the current version. If, like me, you’re lazy, you can copy and paste everything up to and including “skype” then press the Tab key… the Terminal will fill in the rest of the file name).

That’s pretty much it. Skype can be found under Applications -> Internet -> Skype.

Since Skype is a Qt application, it is possible to customise the interface using an application called qtconfig. For Completeness I also installed the msttcorefonts package, which installs a few, well, core MS True Type fonts, such as Times, Courier, etc.

sudo apt-get install msttcorefonts
sudo fc-cache -fv

Running fc-cache will rebuild the Font cache to include the newly installed fonts. Restarting X by pressing Ctrl+Alt+Backspace will also do the trick. With this done, I installed the Qt Config application:

sudo apt-get install qt3-qtconfig

To give the Qt applications a “Gnomeish” look, there is a theme called Polymer available:

sudo apt-get install polymer

With these installed, it is possible to run the Qt Config tool from either System -> Preferences -> Qt3 Configuration, or by executing qtconfig in a terminal. The first tab - Appearance - allows us to select the Polymer theme, by changing “Select GUI Style” to Polymer:

The second tab, “Fonts” allows control over how Qt displays text. Skype can be made more readable and friendly, by increasing the font size to 10 Points, and changing the font family to Sans Serif:

Save the changes with either File -> Save or Ctrl+S, exit, and start Skype (or any Qt application) to see the changes.

That’s it!

References:

written by Hodge \\ tags: , ,

May 11
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I noticed today that a bunch of applications, and even some web sites were displaying interesting fonts, making the application/web site unusable and unreadable - most notably QT applications. The text rendered like an interesting cross between Hindu and Arabic. This issue just so happened to crop up shortly after transferring a bunch of fonts over from my Windozzze partition to Linux:

cd /media/hda1/WINDOWS/Fonts
cp * ~/.fonts
sudo fc-cache -fv

Basically, there seemed to be a conflict between the fonts already installed in Linux, and the fonts I had just transferred over. So, I removed all the fonts, and copied over just the True Type Fonts and Open Type Fonts:

cd ~/.fonts
rm *.*
cd /media/hda1/WINDOWS/Fonts
cp *.ttf *.TTF *.otf *.OTF ~/.fonts
sudo fc-cache -fv

So far so good - the funky script has been replaced with readable text. I guess I’ll have to move the rest one-by-one to find the miscreant font…

written by Hodge \\ tags: ,

Webloogle Blog Directory