Mobile devices in GNU/Linux and GNOME

Use your hand-held device under GNOME

Short URL: http://fsmsh.com/2734

Write a full post in response to this!

You have a computer (a laptop or a desktop). Since it’s a machine you use often and don’t tinker with much, it probably runs Ubuntu Linux. Or, maybe, another distribution (like Mandriva 2008). If it doesn’t run GNU/Linux, I hope you’re at least using BSD. If not, stop reading right now!

You also have a brand new digital camera, or a shiny new MP3 player. And you feel the dread: are those pure consumer oriented pieces of hardware compatible with my machine? Will I have to pay the Microsoft tax (and the required hardware upgrades) to get all my photos from my last holidays, or to listen to Beethoven’s fifth sung a capella by lazy llamas? Read on.

Software requirements

What exactly do you need? If you’re running a recent version of Ubuntu Linux (Feisty Fawn or Gutsy Gibbon), you’re all set. If you’re not (like me), you’ll need the following:

  • Linux Kernel 2.6.22, with HAL and hald running (pretty much standard)

  • dbus 1.0.2 (also standard).

No, these are not bad words. Let’s look at what they actually represent.

HAL

HALD (Hardware Abstraction Layer Daemon) reports kernel events; when some pieces of hardware are connected, it notifies another daemon, udev, which creates a device in /dev. The device creation event is also picked up by FreeDesktop.org’s dbus, which then follows a set or rules (typically written by the distributor of your flavour of GNU/Linux, stored into e.g. /etc/dbus-1 as a set of text files). Depending on your device identification, it will start a set of actions to make it usable.

dbus

dbus usually works with your desktop manager, and is a main component of the Freedesktop.org’s specifications: as such, GNOME, KDE and Xfce (at least) will usually use it to perform some sort of user interface actions. One one hand, dbus notifies the window manager that a new device has appeared; dbus will check with its sets of rules, and start whatever action is set for this action: typically, a webcam creates an icon on the desktop linked to Ekiga, a CD/DVD disk triggers a file system browse (or if said drive is empty, ask if you want to burn it), etc.

Let’s look at the matter at hand: both MP3 players (or more accurately, mass-storage based digital players) and digital cameras have one thing in common: they are ultimately storage devices, and their main use is to carry or transfer data (the fact that the camera at least can generate its own data is pretty much irrelevant here).

Both MP3 players and digital cameras have one thing in common: they are ultimately storage devices

As such, they will usually broadcast themselves as storage devices: the kernel will pick up on that and, through hald and udev, load the corresponding drive controller driver (if the drive contains some media, it will also create the corresponding devices).

Most devices use an USB connection (or, as is the case for the iPod, an alternative IEEE1394/Firewire); what usually happens then, is that the kernel will:

  • load the usb_storage module (if it hasn’t already);
  • create a device for the driver (probably /dev/sda if you still have everything in IDE, kick up the last letter a notch for every SCSI-like drive you have installed if not)
  • detect if the drive contains a media—in such case it will create partition devices (like /dev/sda1, /dev/sda2…): usually one, but some (like the iPod) contain at least two partitions.

One sure way to know is to look at dmesg’s last lines: you’ll see the kernel detect the device, then configure it. Use dmesg | tail to keep it legible, and that’s it. When these devices appear, dbus picks up on the kernel event and transmits it to the desktop manager: GNOME will then, by default, ask the system through dbus to create a mount point in /media, and mount the drive with default settings. Please note that GNOME relies upon the generic mount command to auto-detect the drive’s settings: you may need to specify some details, although it is very unlikely: most hand-held media use FAT or FAT32, and these simplistic file systems don’t have lots of options (it would be another matter if some used, say, NTFS), so mount usually gets them mounted nice and tight (you may still have trouble with files containing accented characters: look at vfat’s character encoding mount options if that happens).

Don't miss out on the other pages!
1234next ›last »

Write a full post in response to this!

3

Do you like this post?
Vote for it!

Copyright information

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation. A copy of the license is available at http://www.gnu.org/copyleft/gpl.html.

Biography

Mitch Meyran: Have you ever fixed a computer with a hammer, glue and a soldering iron? Why not? It's fun!

gingas's picture

no subj.

Submitted by gingas on Sat, 2008-06-14 17:42.

Vote!
0

"If it doesn’t run GNU/Linux, I hope you’re at least using BSD. If not, stop reading right now!" Man you are paranoiac! It's not good to you neurons. Just try to live without noticing of Windows and M$ existence. ;)

Mitch Meyran's picture

Oh, actually I konw about Windows...

Submitted by Mitch Meyran on Sun, 2008-06-15 22:24.

Vote!
0

...I also know that almost nothing that is said in the article would relate with the experience under Windows. In fact, GNOME doesn't run under Windows (Windows doesn't support alternate window managers) - so, I'm adding this sentence to those people who read too fast or don't really understand what's written.

It is also an ironic statement: who would actually obey that?

You may want to check your vocabulary and grammar: in English, it's "paranoid"; then, "it's not good for"; and last, it's "noticing (something)'s existence".
---
A computer is like air conditioning: it becomes useless when you open windows.



Other sites

Free Software Magazine uses Apollo project management and CRM for its everyday activities!