{"id":79,"date":"2007-03-24T08:15:44","date_gmt":"2007-03-24T13:15:44","guid":{"rendered":"http:\/\/www.summet.com\/blog\/2007\/03\/24\/creating-udev-rules-to-name-your-devices-in-mandriva\/"},"modified":"2007-03-24T08:15:44","modified_gmt":"2007-03-24T13:15:44","slug":"creating-udev-rules-to-name-your-devices-in-mandriva","status":"publish","type":"post","link":"https:\/\/www.summet.com\/blog\/2007\/03\/24\/creating-udev-rules-to-name-your-devices-in-mandriva\/","title":{"rendered":"Creating udev rules to name your devices in Mandriva"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:697,&quot;href&quot;:&quot;http:\\\/\\\/www.reactivated.net\\\/writing_udev_rules.html&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>I have a Motorola cell phone, and when it is plugged into my linux laptop via a USB cable it appears as a <strong>\/dev\/ttyACM0 <\/strong>device. (Unless I already have an ACM device plugged in, then it appears as \/dev\/ttyACM1).&nbsp; BUT, it&#39;s much nicer to be able to point my phone programs (such as kmobiletools and moto4lin) at a logical device, such as <strong>\/dev\/mobile<\/strong> where the number won&#39;t change than to point it at the kernel device name.<\/p>\n<p><!--more--> <\/p>\n<p>You can make an automatic symlink from \/dev\/mobile to whatever actual \/dev\/ttyACM* device the device appears with using a simple udev rule. Edit a new file in your \/etc\/udev\/rules.d directory named mobile.rules and add the following as a single line:<\/p>\n<p><strong>BUS==&quot;usb&quot;, KERNEL==&quot;ttyACM*&quot;, SYSFS{product}==&quot;Motorola Phone*&quot;, SYMLINK+=&quot;mobile&quot;<\/strong><\/p>\n<p>This tells the udev subsystem that whenever a new device that has a ttyACM kernel device name and a product ID of &quot;Motorola Phone&quot; appears on the USB bus to create a link to it named &quot;mobile&quot; (as this is udev, the full link will be <strong>\/dev\/mobile<\/strong>).<\/p>\n<p>Now, if you only have one mobile phone, this may not be terribly useful. But how about if you have an MP3 Player and a Camera which both appear as \/dev\/sda1 or \/dev\/sda2 when you plug them in? Now you can make a logical name for each device, such as \/dev\/camera-fs and \/dev\/mp3-fs. You can even write a rule to automatically mount these devices to \/mnt\/mp3player and \/mnt\/camera when they are plugged in!<\/p>\n<p>For more details about all of the great things you can do with custom udev rules, see Daniel Drake&#39;s excellent <a href=\"http:\/\/www.reactivated.net\/writing_udev_rules.html\">tutorial<\/a>.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a Motorola cell phone, and when it is plugged into my linux laptop via a USB cable it appears as a \/dev\/ttyACM0 device. (Unless I already have an ACM device plugged in, then it appears as \/dev\/ttyACM1).&nbsp; BUT, &hellip; <a href=\"https:\/\/www.summet.com\/blog\/2007\/03\/24\/creating-udev-rules-to-name-your-devices-in-mandriva\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-linux","category-goodlinks"],"_links":{"self":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":0,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}