{"id":3,"date":"2008-05-07T14:01:53","date_gmt":"2008-05-07T12:01:53","guid":{"rendered":"http:\/\/valentijn.sessink.nl\/?p=3"},"modified":"2008-07-18T16:04:58","modified_gmt":"2008-07-18T14:04:58","slug":"walkera-helicopters-under-linux-part-1","status":"publish","type":"post","link":"https:\/\/valentijn.sessink.nl\/?p=3","title":{"rendered":"Walkera helicopters under Linux &#8211; part 1"},"content":{"rendered":"<p>A couple of months ago, I bought a Walkera Dragonfly #04, just for fun. While actually flying an RC helicopter is great fun, sometimes you will want to use a simulator.  As Linux is my platform of choice, I tried using the Walkera transmitter with a serial cable to run a heli-sim. I found out how to do that; here&#8217;s the results of my quest. This article will be split in 3 parts: kernel; utility; Heli-X. This is the first part.<\/p>\n<p>I will use Ubuntu Linux 8.04 Hardy Heron for my explanation. You can use other versions of Linux &#8211; but please beware, you will need a pretty recent kernel to be able to build the kernel module.<br \/>\n<!--more--><br \/>\nFirst, what will you need. You&#8217;ll need the right hardware: a sim cable to connect to your Walkera transmitter; and most likely a serial-to-USB converter to connect the serial cable to your PC. You will need a PC with 3D acceleration, as the simulator we&#8217;ll be using makes use of it. Software 3D won&#8217;t cut it here.<\/p>\n<p>Then the software. If I&#8217;m right, from kernel 2.6.26, the Zhen Hua kernel module will be included in Linux right away. By then, you won&#8217;t be needing any patching and recompiling &#8211; and this article will be out of date anyway. Until then, read on. You will need a kernel module for your transmitter; a new version of the <em>inputattach<\/em> utility. For simulation, we&#8217;ll be using <a title=\"Heli-X simulator (opens in new window)\" href=\"http:\/\/heli-x.net\" target=\"_blank\">Heli-X<\/a>, a great Java-based helicopter simulator.<\/p>\n<h3>kernel<\/h3>\n<p>First, the kernel module. We could go the &#8220;official&#8221; way and compile a new kernel with a new version number. This gives us a proper .deb file with a proper version number. However, it also gives us a lot of work.  So we&#8217;ll go the rogue way: we will just compile a single module and sneak it into the kernel module tree. Then, we will compile the inputattach utility with an extra header-file to accommodate to this new module. And please remember: if you&#8217;re old enough to complain about the mess we&#8217;re making, then you&#8217;re old enough to make it clean as well.<\/p>\n<p>Firstly, we will install a couple of packages to be able to build our stuff:<br \/>\n<code>$ sudo aptitude install build-essential fakeroot debhelper<\/code> devscripts<br \/>\nNow get your kernel version:<br \/>\n<code>$ uname -r<\/code><br \/>\n<em>2.6.24-16-generic<\/em><\/p>\n<p>We will get the source of this kernel. Put it anywhere you like.<em><\/em><br \/>\n<code>$ apt-get source linux-image-`uname -r`<\/code><br \/>\nNow patch your code. Get the <a href=\"https:\/\/valentijn.sessink.nl\/wp-content\/uploads\/2008\/05\/zhen-huapatch.txt\">zhen-hua.patch<\/a> and type<br \/>\n<code>$ cd linux-source-2.6.24-2.6.24\/ ; patch -p1 &lt; zhen-hua.patch.txt<\/code><br \/>\nSelect the module: one way to do that is to configure the kernel with your current configuration, telling it you want a Zhen Hua module (answer &#8220;m&#8221;):<br \/>\n<code>$ cp \/boot\/config-`uname -r` .config; make oldconfig<\/code><br \/>\nThen build:<br \/>\n<code>$ make drivers\/input\/joystick\/zhenhua.ko<\/code><br \/>\nCopy to your current modules:<br \/>\n<code>$ sudo cp drivers\/input\/joystick\/zhenhua.ko \/lib\/modules\/`uname -r`\/kernel\/drivers\/input\/joystick\/; sudo depmod -a<\/code><br \/>\nAnd finally, insert the module in your kernel:<br \/>\n<code>$ sudo modprobe zhenhua<\/code><br \/>\nYou are now ready for step 2, the inputattach utility.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A couple of months ago, I bought a Walkera Dragonfly #04, just for fun. While actually flying an RC helicopter is great fun, sometimes you will want to use a simulator. As Linux is my platform of choice, I tried using the Walkera transmitter with a serial cable to run a heli-sim. I found out&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[8,10,5,9,7,4],"class_list":["post-3","post","type-post","status-publish","format-standard","hentry","category-happy-hacking","tag-8","tag-hardy-heron","tag-heli-x","tag-linux","tag-ubuntu","tag-walkera"],"_links":{"self":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts\/3","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3"}],"version-history":[{"count":0,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts\/3\/revisions"}],"wp:attachment":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}