1 |
On Tue, Sep 11, 2012 at 10:30 AM, Chris Stankevitz |
2 |
<chrisstankevitz@×××××.com> wrote: |
3 |
> On Mon, Sep 10, 2012 at 10:03 PM, Walter Dnes <waltdnes@××××××××.org> wrote: |
4 |
>> Every time that a USB device is inserted or removed, an |
5 |
>> "event" is triggered by the kernel. What's required is an "event |
6 |
>> handler" that reacts appropriately to those events. This is usually |
7 |
>> udev, but mdev will also work. I've replaced udev with mdev on my |
8 |
>> machine ( see https://wiki.gentoo.org/wiki/Mdev ) and I've implemented |
9 |
>> USB automounting under mdev, using scripts. It works even in text |
10 |
>> console mode. See https://wiki.gentoo.org/wiki/Mdev/Automount_USB |
11 |
> |
12 |
> Walter, |
13 |
> |
14 |
> Thank you. What I'm hearing is: |
15 |
> |
16 |
> 1. There are many ways to get USB automount |
17 |
|
18 |
Correct. |
19 |
|
20 |
> 2. One way is to install udev and fabricate the correct scripting to |
21 |
> cause the automount to take place |
22 |
|
23 |
That it's the "I want to do it by hand" way. |
24 |
|
25 |
> 3. By some magic a GUI system such as GNOME, XFCE, TWM, etc will |
26 |
> recognize when (2) happens and show an icon on the desktop [I'm |
27 |
> talking somewhat tongue in cheek WRT TWM] |
28 |
|
29 |
That is the automagical™ way. |
30 |
|
31 |
> If this is correct, I'd like to know: |
32 |
> |
33 |
> a) what is the scripting I need to fabricate to get (2) to work correctly. |
34 |
|
35 |
I you want to do it by hand (which is as useful as trying to drive a |
36 |
car as the Flinstones, i.e., with your own feet), you need to create |
37 |
an udev rule. An old tutorial on that is: |
38 |
|
39 |
http://www.reactivated.net/writing_udev_rules.html |
40 |
|
41 |
It's a little outdated, since from some years ago it has been working |
42 |
"out-of-the-box" in almost all Linux distros, specially if they |
43 |
install and configure udev as intended by its upstream. So the need |
44 |
for users to handle udev rules has been greatly reduced. |
45 |
|
46 |
> b) what is the magic by which (3) happens. |
47 |
|
48 |
It's not magic; just the modern desktop environments install a program |
49 |
(or programs) that installs udev rules, and that handle things like |
50 |
the pretty icons (or notifications, or whatever). In GNOME 3 case, the |
51 |
program is udisks (version 2), which installs: |
52 |
|
53 |
/usr/lib/udev/rules.d/80-udisks2.rules |
54 |
|
55 |
Then it handles everything for you. Please also note that USB stick |
56 |
mounting is just *ONE* of the gazillion things udev (and other parts |
57 |
of the stack) takes care of. For example, in this screenshot: |
58 |
|
59 |
https://plus.google.com/115256116066287398549/posts/JX6kRciZ9zA |
60 |
|
61 |
I'm configuring Skype to use my bluetooth head set for input/output of |
62 |
sound, while the rest of my system keeps using the desktop sound card. |
63 |
The whole shebang is powered by udev (for detecting the headset as |
64 |
source/sink for audio), bluez (for pairing it), pulseaudio (for |
65 |
switching sound streams on the fly), etc. You can (of course) do all |
66 |
of this by hand, but it gets pretty convoluted after a while. |
67 |
|
68 |
Mounting USB sticks is easy; as Philip said, you can do it with |
69 |
"mount" in a terminal as root (for example). It could be argued about |
70 |
how smart is to do it, but it's easy alright. |
71 |
|
72 |
I care more about stuff like the above screenshot; I could argue that |
73 |
it's easier (or at least not as difficult) to set up a BT headset for |
74 |
use with Skype on the fly on Linux than on Mac OS X or Windows. For |
75 |
that level of easiness and automagicality™, you need the whole stack |
76 |
working correctly. |
77 |
|
78 |
It is nice to learn how to do all of that by hand; if you have the |
79 |
time (and the interest) is a nice thing to do. For doing real work, |
80 |
it's not very useful. |
81 |
|
82 |
Regards. |
83 |
-- |
84 |
Canek Peláez Valdés |
85 |
Posgrado en Ciencia e Ingeniería de la Computación |
86 |
Universidad Nacional Autónoma de México |