]> pere.pagekite.me Git - homepage.git/blob - blog/data/2013-01-09-hw-autoinstall.txt
Generated.
[homepage.git] / blog / data / 2013-01-09-hw-autoinstall.txt
1 Title: Lets make hardware dongles easier to use in Debian
2 Tags: english, debian, isenkram
3 Date: 2013-01-09 15:40
4
5 <p>One thing that annoys me with Debian and Linux distributions in
6 general, is that there is a great package management system with the
7 ability to automatically install software packages by downloading them
8 from the distribution mirrors, but no way to get it to automatically
9 install the packages I need to use the hardware I plug into my
10 machine. Even if the package to use it is easily available from the
11 Linux distribution. When I plug in a LEGO Mindstorms NXT, it could
12 suggest to automatically install the python-nxt, nbc and t2n packages
13 I need to talk to it. When I plug in a Yubikey, it could propose the
14 yubikey-personalization package. The information required to do this
15 is available, but no-one have pulled all the pieces together.</p>
16
17 <p>Some years ago, I proposed to
18 <a href="http://lists.debian.org/debian-devel/2010/05/msg01206.html">use
19 the discover subsystem to implement this</a>. The idea is fairly
20 simple:
21
22 <ul>
23
24 <li>Add a desktop entry in /usr/share/autostart/ pointing to a program
25 starting when a user log in.</li>
26
27 <li>Set this program up to listen for kernel events emitted when new
28 hardware is inserted into the computer.</li>
29
30 <li>When new hardware is inserted, look up the hardware ID in a
31 database mapping to packages, and take note of any non-installed
32 packages.</li>
33
34 <li>Show a message to the user proposing to install the discovered
35 package, and make it easy to install it.</li>
36
37 </ul>
38
39 <p>I am not sure what the best way to implement this is, but my
40 initial idea was to use dbus events to discover new hardware, the
41 discover database to find packages and
42 <a href="http://www.packagekit.org/">PackageKit</a> to install
43 packages.</p>
44
45 <p>Yesterday, I found time to try to implement this idea, and the
46 draft package is now checked into
47 <a href="http://anonscm.debian.org/viewvc/debian-edu/trunk/src/hw-support-handler/">the
48 Debian Edu subversion repository</a>. In the process, I updated the
49 <a href="http://packages.qa.debian.org/d/discover-data.html">discover-data</a>
50 package to map the USB ids of LEGO Mindstorms and Yubikey devices to
51 the relevant packages in Debian, and uploaded a new version
52 2.2013.01.09 to unstable. I also discovered that the current
53 <a href="http://packages.qa.debian.org/d/discover.html">discover</a>
54 package in Debian no longer discovered any USB devices, because
55 /proc/bus/usb/devices is no longer present. I ported it to use
56 libusb as a fall back option to get it working. The fixed package
57 version 2.1.2-6 is now in experimental (didn't upload it to unstable
58 because of the freeze).</p>
59
60 <p>With this prototype in place, I can insert my Yubikey, and get this
61 desktop notification to show up (only once, the first time it is
62 inserted):</p>
63
64 <p align="center"><img src="http://www.hungry.com/~pere/blog/images/2013-01-09-hw-autoinstall.png"></p>
65
66 <p>For this prototype to be really useful, some way to automatically
67 install the proposed packages by pressing the "Please install
68 program(s)" button should to be implemented.</p>
69
70 <p>If this idea seem useful to you, and you want to help make it
71 happen, please help me update the discover-data database with mappings
72 from hardware to Debian packages. Check if 'discover-pkginstall -l'
73 list the package you would like to have installed when a given
74 hardware device is inserted into your computer, and report bugs using
75 reportbug if it isn't. Or, if you know of a better way to provide
76 such mapping, please let me know.</p>
77
78 <p>This prototype need more work, and there are several questions that
79 should be considered before it is ready for production use. Is dbus
80 the correct way to detect new hardware? At the moment I look for HAL
81 dbus events on the system bus, because that is the events I could see
82 on my Debian Squeeze KDE desktop. Are there better events to use?
83 How should the user be notified? Is the desktop notification
84 mechanism the best option, or should the background daemon raise a
85 popup instead? How should packages be installed? When should they
86 not be installed?</p>
87
88 <p>If you want to help getting such feature implemented in Debian,
89 please send me an email. :)</p>