On Tue, Sep 11, 2012 at 10:30 AM, Chris Stankevitz
<chrisstankev...@gmail.com> wrote:
> On Mon, Sep 10, 2012 at 10:03 PM, Walter Dnes <waltd...@waltdnes.org> wrote:
>> Every time that a USB device is inserted or removed, an
>> "event" is triggered by the kernel.  What's required is an "event
>> handler" that reacts appropriately to those events.  This is usually
>> udev, but mdev will also work.  I've replaced udev with mdev on my
>> machine ( see https://wiki.gentoo.org/wiki/Mdev ) and I've implemented
>> USB automounting under mdev, using scripts.  It works even in text
>> console mode.  See https://wiki.gentoo.org/wiki/Mdev/Automount_USB
>
> Walter,
>
> Thank you.  What I'm hearing is:
>
> 1. There are many ways to get USB automount

Correct.

> 2. One way is to install udev and fabricate the correct scripting to
> cause the automount to take place

That it's the "I want to do it by hand" way.

> 3. By some magic a GUI system such as GNOME, XFCE, TWM, etc will
> recognize when (2) happens and show an icon on the desktop [I'm
> talking somewhat tongue in cheek WRT TWM]

That is the automagical™ way.

> If this is correct, I'd like to know:
>
> a) what is the scripting I need to fabricate to get (2) to work correctly.

I you want to do it by hand (which is as useful as trying to drive a
car as the Flinstones, i.e., with your own feet), you need to create
an udev rule. An old tutorial on that is:

http://www.reactivated.net/writing_udev_rules.html

It's a little outdated, since from some years ago it has been working
"out-of-the-box" in almost all Linux distros, specially if they
install and configure udev as intended by its upstream. So the need
for users to handle udev rules has been greatly reduced.

> b) what is the magic by which (3) happens.

It's not magic; just the modern desktop environments install a program
(or programs) that installs udev rules, and that handle things like
the pretty icons (or notifications, or whatever). In GNOME 3 case, the
program is udisks (version 2), which installs:

/usr/lib/udev/rules.d/80-udisks2.rules

Then it handles everything for you. Please also note that USB stick
mounting is just *ONE* of the gazillion things udev (and other parts
of the stack) takes care of. For example, in this screenshot:

https://plus.google.com/115256116066287398549/posts/JX6kRciZ9zA

I'm configuring Skype to use my bluetooth head set for input/output of
sound, while the rest of my system keeps using the desktop sound card.
The whole shebang is powered by udev (for detecting the headset as
source/sink for audio), bluez (for pairing it), pulseaudio (for
switching sound streams on the fly), etc. You can (of course) do all
of this by hand, but it gets pretty convoluted after a while.

Mounting USB sticks is easy; as Philip said, you can do it with
"mount" in a terminal as root (for example). It could be argued about
how smart is to do it, but it's easy alright.

I care more about stuff like the above screenshot; I could argue that
it's easier (or at least not as difficult) to set up a BT headset for
use with Skype on the fly on Linux than on Mac OS X or Windows. For
that level of easiness and  automagicality™, you need the whole stack
working correctly.

It is nice to learn how to do all of that by hand; if you have the
time (and the interest) is a nice thing to do. For doing real work,
it's not very useful.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México

Reply via email to