{"id":3195,"date":"2014-01-16T14:55:52","date_gmt":"2014-01-16T14:55:52","guid":{"rendered":"http:\/\/really.zonky.org\/?p=3195"},"modified":"2014-01-16T16:59:48","modified_gmt":"2014-01-16T16:59:48","slug":"linux-dream-cheeky-usb-thunder-missile-launcher","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=3195","title":{"rendered":"Linux Dream Cheeky USB Thunder Missile Launcher"},"content":{"rendered":"<p>This is not original work, but merely a set of notes on how to do the set up. The core information (and the code) came from this <a href=\"http:\/\/blog.feabhas.com\/2012\/10\/i-dream-of-a-cheeky-missile-launcher\/\">blog<\/a> posting.<\/p>\n<p>Essentially I&#8217;ve re-ordered the steps in which to work and excluded anything other than the bare essentials to get it all working. With the intention I can get my missile launcher working at home and at work\u00a0 \ud83d\ude0e<\/p>\n<p>Step 1 is to prevent the HID driver from clamping on to the missile launcher. This was done by :-<\/p>\n<ol>\n<li>Editing\u00a0<em>\/etc\/default\/grub<\/em> and adding\u00a0<em>usbhid.quirks=0x2123:0x1010:0x04<\/em> to the existing variable\u00a0<em>GRUB_CMDLINE_LINUX_DEFAULT<\/em>.<\/li>\n<li>Run\u00a0<em>update-grub<\/em> (I always manage to forget this).<\/li>\n<li>Reboot the machine and check\u00a0<em>\/var\/log\/messages<\/em> for\u00a0<em>2123<\/em> (the VendorID) to see if it has been claimed by\u00a0<em>usbhid<\/em> (which will show up as a line beginning\u00a0<em>generic-usb 0003:2123:1010.0006: hiddev0<\/em> if it does claim it).<\/li>\n<\/ol>\n<p>The next step is to download and compile the code given in the blog link above. If you need instructions on how to do this, then you probably need to look elsewhere &#8211; it builds easily.<\/p>\n<p>Once built, an\u00a0<em>sudo insmod launcher_driver.ko<\/em> will verify that the kernel module loads &#8211; you can double check by looking at\u00a0<em>\/var\/log\/messages<\/em>.<\/p>\n<p>It&#8217;s also necessary to install both the kernel driver and the control program manually :-<\/p>\n<ol>\n<li>Copy the compiled kernel module to <em>\/lib\/modules<\/em>:\u00a0<em>sudo cp\u00a0<\/em>\u00a0<em>launcher_driver.ko \/lib\/modules<\/em><\/li>\n<li>Edit\u00a0<em>\/etc\/rc.local<\/em> and add the command: <em>\/sbin\/insmod \/lib\/modules\/launcher_driver.ko<\/em><\/li>\n<li>Copy the control program to a sensible location:\u00a0<em>sudo\u00a0install launcher_control \/opt\/bin<\/em><\/li>\n<\/ol>\n<p>There&#8217;s probably better ways of doing this, and better places to stick things but as you&#8217;re following my instructions you&#8217;re stuck with my suggestions! It&#8217;s tempting to try a reboot at this stage to verify that this works, but as there&#8217;s just one small extra step we may as well get that done too. This is to create a\u00a0<em>udev<\/em> rule to set up a device file in\u00a0<em>\/dev<\/em>.<\/p>\n<p>Create a file (<em>\/etc\/udev\/rules.d\/99-usb-launcher.rules<\/em>) with the following contents :-<\/p>\n<pre>KERNEL==\"launcher?*\",MODE=\"0660\",GROUP=\"cdrom\"<\/pre>\n<p>The choice of group name is rather inappropriate except it will work well enough, and I have changed the permissions on this to something a little more restrictive. This can be tested with <em>sudo udevadm trigger<\/em> which will re-run udev. This should change the permissions on any existing <em>\/dev\/launcher*<\/em> file(s). If it doesn&#8217;t work, the blog pointer above is the place to head.<\/p>\n<p>Lastly, there&#8217;s a couple of corrections to the\u00a0<em>launcher_control.c<\/em> that is convenient to make :-<\/p>\n<pre>\r\n% diff launcher_control.c launcher_control.c.orig\r\n63c63\r\n<         while ((c = getopt(argc, argv, \"m:lrudfsht:\")) != -1) {\r\n---\r\n>         while ((c = getopt(argc, argv, \"mlrudfsht:\")) != -1) {\r\n97,98c97\r\n< \t\tfprintf(stderr, \"Couldn't open file: %s\\n\", dev);\r\n<                 \/*perror(\"Couldn't open file: %m\");*\/\r\n---\r\n>                 perror(\"Couldn't open file: %m\");\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is not original work, but merely a set of notes on how to do the set up. The core information (and the code) came from this blog posting. Essentially I&#8217;ve re-ordered the steps in which to work and excluded anything other than the bare essentials to get it all working. With the intention I <a href='https:\/\/really.zonky.org\/?p=3195' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[4,209,226],"tags":[43,1168],"class_list":["post-3195","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-it","category-working-notes","tag-linux","tag-missile-launcher","category-4-id","category-209-id","category-226-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-Px","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/3195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3195"}],"version-history":[{"count":4,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/3195\/revisions"}],"predecessor-version":[{"id":3199,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/3195\/revisions\/3199"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}