]> pere.pagekite.me Git - homepage.git/blob - blog/archive/2016/10/10.rss
Generated.
[homepage.git] / blog / archive / 2016 / 10 / 10.rss
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>
3 <channel>
4 <title>Petter Reinholdtsen - Entries from October 2016</title>
5 <description>Entries from October 2016</description>
6 <link>http://people.skolelinux.org/pere/blog/</link>
7
8
9 <item>
10 <title>Isenkram, Appstream and udev make life as a LEGO builder easier</title>
11 <link>http://people.skolelinux.org/pere/blog/Isenkram__Appstream_and_udev_make_life_as_a_LEGO_builder_easier.html</link>
12 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Isenkram__Appstream_and_udev_make_life_as_a_LEGO_builder_easier.html</guid>
13 <pubDate>Fri, 7 Oct 2016 09:50:00 +0200</pubDate>
14 <description>&lt;p&gt;&lt;a href=&quot;http://packages.qa.debian.org/isenkram&quot;&gt;The Isenkram
15 system&lt;/a&gt; provide a practical and easy way to figure out which
16 packages support the hardware in a given machine. The command line
17 tool &lt;tt&gt;isenkram-lookup&lt;/tt&gt; and the tasksel options provide a
18 convenient way to list and install packages relevant for the current
19 hardware during system installation, both user space packages and
20 firmware packages. The GUI background daemon on the other hand provide
21 a pop-up proposing to install packages when a new dongle is inserted
22 while using the computer. For example, if you plug in a smart card
23 reader, the system will ask if you want to install &lt;tt&gt;pcscd&lt;/tt&gt; if
24 that package isn&#39;t already installed, and if you plug in a USB video
25 camera the system will ask if you want to install &lt;tt&gt;cheese&lt;/tt&gt; if
26 cheese is currently missing. This already work just fine.&lt;/p&gt;
27
28 &lt;p&gt;But Isenkram depend on a database mapping from hardware IDs to
29 package names. When I started no such database existed in Debian, so
30 I made my own data set and included it with the isenkram package and
31 made isenkram fetch the latest version of this database from git using
32 http. This way the isenkram users would get updated package proposals
33 as soon as I learned more about hardware related packages.&lt;/p&gt;
34
35 &lt;p&gt;The hardware is identified using modalias strings. The modalias
36 design is from the Linux kernel where most hardware descriptors are
37 made available as a strings that can be matched using filename style
38 globbing. It handle USB, PCI, DMI and a lot of other hardware related
39 identifiers.&lt;/p&gt;
40
41 &lt;p&gt;The downside to the Isenkram specific database is that there is no
42 information about relevant distribution / Debian version, making
43 isenkram propose obsolete packages too. But along came AppStream, a
44 cross distribution mechanism to store and collect metadata about
45 software packages. When I heard about the proposal, I contacted the
46 people involved and suggested to add a hardware matching rule using
47 modalias strings in the specification, to be able to use AppStream for
48 mapping hardware to packages. This idea was accepted and AppStream is
49 now a great way for a package to announce the hardware it support in a
50 distribution neutral way. I wrote
51 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Using_appstream_with_isenkram_to_install_hardware_related_packages_in_Debian.html&quot;&gt;a
52 recipe on how to add such meta-information&lt;/a&gt; in a blog post last
53 December. If you have a hardware related package in Debian, please
54 announce the relevant hardware IDs using AppStream.&lt;/p&gt;
55
56 &lt;p&gt;In Debian, almost all packages that can talk to a LEGO Mindestorms
57 RCX or NXT unit, announce this support using AppStream. The effect is
58 that when you insert such LEGO robot controller into your Debian
59 machine, Isenkram will propose to install the packages needed to get
60 it working. The intention is that this should allow the local user to
61 start programming his robot controller right away without having to
62 guess what packages to use or which permissions to fix.&lt;/p&gt;
63
64 &lt;p&gt;But when I sat down with my son the other day to program our NXT
65 unit using his Debian Stretch computer, I discovered something
66 annoying. The local console user (ie my son) did not get access to
67 the USB device for programming the unit. This used to work, but no
68 longer in Jessie and Stretch. After some investigation and asking
69 around on #debian-devel, I discovered that this was because udev had
70 changed the mechanism used to grant access to local devices. The
71 ConsoleKit mechanism from &lt;tt&gt;/lib/udev/rules.d/70-udev-acl.rules&lt;/tt&gt;
72 no longer applied, because LDAP users no longer was added to the
73 plugdev group during login. Michael Biebl told me that this method
74 was obsolete and the new method used ACLs instead. This was good
75 news, as the plugdev mechanism is a mess when using a remote user
76 directory like LDAP. Using ACLs would make sure a user lost device
77 access when she logged out, even if the user left behind a background
78 process which would retain the plugdev membership with the ConsoleKit
79 setup. Armed with this knowledge I moved on to fix the access problem
80 for the LEGO Mindstorms related packages.&lt;/p&gt;
81
82 &lt;p&gt;The new system uses a udev tag, &#39;uaccess&#39;. It can either be
83 applied directly for a device, or is applied in
84 /lib/udev/rules.d/70-uaccess.rules for classes of devices. As the
85 LEGO Mindstorms udev rules did not have a class, I decided to add the
86 tag directly in the udev rules files included in the packages. Here
87 is one example. For the nqc C compiler for the RCX, the
88 &lt;tt&gt;/lib/udev/rules.d/60-nqc.rules&lt;/tt&gt; file now look like this:
89
90 &lt;p&gt;&lt;pre&gt;
91 SUBSYSTEM==&quot;usb&quot;, ACTION==&quot;add&quot;, ATTR{idVendor}==&quot;0694&quot;, ATTR{idProduct}==&quot;0001&quot;, \
92 SYMLINK+=&quot;rcx-%k&quot;, TAG+=&quot;uaccess&quot;
93 &lt;/pre&gt;&lt;/p&gt;
94
95 &lt;p&gt;I suspect all packages using plugdev in their /lib/udev/rules.d/
96 files should be changed to use this tag (either directly or indirectly
97 via &lt;tt&gt;70-uaccess.rules&lt;/tt&gt;). Perhaps a lintian check should be
98 created to detect this?&lt;/p&gt;
99
100 &lt;p&gt;I&#39;ve been unable to find good documentation on the uaccess feature.
101 It is unclear to me if the uaccess tag is an internal implementation
102 detail like the udev-acl tag used by
103 &lt;tt&gt;/lib/udev/rules.d/70-udev-acl.rules&lt;/tt&gt;. If it is, I guess the
104 indirect method is the preferred way. Michael
105 &lt;a href=&quot;https://github.com/systemd/systemd/issues/4288&quot;&gt;asked for more
106 documentation from the systemd project&lt;/a&gt; and I hope it will make
107 this clearer. For now I use the generic classes when they exist and
108 is already handled by &lt;tt&gt;70-uaccess.rules&lt;/tt&gt;, and add the tag
109 directly if no such class exist.&lt;/p&gt;
110
111 &lt;p&gt;To learn more about the isenkram system, please check out
112 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/tags/isenkram/&quot;&gt;my
113 blog posts tagged isenkram&lt;/a&gt;.&lt;/p&gt;
114
115 &lt;p&gt;To help out making life for LEGO constructors in Debian easier,
116 please join us on our IRC channel
117 &lt;a href=&quot;irc://irc.debian.org/%23debian-lego&quot;&gt;#debian-lego&lt;/a&gt; and join
118 the &lt;a href=&quot;https://alioth.debian.org/projects/debian-lego/&quot;&gt;Debian
119 LEGO team&lt;/a&gt; in the Alioth project we created yesterday. A mailing
120 list is not yet created, but we are working on it. :)&lt;/p&gt;
121
122 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
123 activities, please send Bitcoin donations to my address
124 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&amp;label=PetterReinholdtsenBlog&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
125 </description>
126 </item>
127
128 </channel>
129 </rss>