{"id":783,"date":"2011-09-25T15:50:49","date_gmt":"2011-09-25T15:50:49","guid":{"rendered":"https:\/\/www.hannahdee.wales\/blog\/?p=783"},"modified":"2011-09-25T16:03:12","modified_gmt":"2011-09-25T16:03:12","slug":"geeky-interlude-getting-an-android-device-to-talk-to-a-linux-machine","status":"publish","type":"post","link":"https:\/\/www.hannahdee.wales\/blog\/?p=783","title":{"rendered":"Geeky interlude: Getting an android device to talk to a linux machine"},"content":{"rendered":"<p>This post details the steps I had to go through to get my eee-pad transformer Android tablet to talk to a linux machine running Ubuntu for development purposes. In particular, I&#8217;m trying to get it to run with AppInventor (a draggy-block-style easy programming environment). There are lots of FAQs and HOWTOs on the net out there, but the straightforward instructions didn&#8217;t work for me so I&#8217;m putting the things I&#8217;ve learned up here, in case someone else can benefit. I&#8217;m guessing this post won&#8217;t be of interest to you unless you&#8217;re trying to mess about with android, running Linux, and haven&#8217;t managed to get development set up yet.<\/p>\r\n<h3>1: Get your device so it&#8217;s ready for development<\/h3>\r\n<p>This step involves changing settings on the android device (not the computer you&#8217;re attaching it to).\r\n<ul>\r\n<li>Under Applications, Development menu, turn on USB debug and Stay awake when charging<\/li>\r\n<li>Under Applications, turn on the setting allowing unknown sources to run code on your device <\/li>\r\n<\/ul>\r\n<p>(Fairly obviously these are security related settings that you probably want to change back once you&#8217;re done developing.)  That&#8217;s all you need to change on the android &#8211; everything else involves messing around on the development machine.<\/p>\r\n<h3>2: Install the AppInventor stuff<\/h3>\r\n<p>You can follow the instructions on the <a href = \"http:\/\/www.appinventorbeta.com\/learn\/setup\/#setupComputer\">Appinventor<\/a> site for this bit.<\/p>\r\n<h3>2a: Install the Android SDK<\/h3>\r\n<p>I&#8217;m not sure if this step is vital &#8211; some pages suggested that the appinventor stuff wasn&#8217;t enough and you need the full SDK. So I installed it &#8211; you can get it from here: <a href =\"http:\/\/developer.android.com\/sdk\/index.html\">Android SDK<\/a>. The key part seems to be the Android Debug Bridge adb, which does indeed come with AppInventor, but hey, having the full SDK probably doesn&#8217;t hurt.<\/p>\r\n<h3>3: Tell your computer about your Android device<\/h3>\r\n<p>This involves using udev, which is the way you tell linux about new devices. Create a file called <code>51-android.rules<\/code> with the contents<\/p>\r\n<code>SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0B05\", MODE=\"0666\"<\/code>\r\n<p>The file should then be moved to the directory <code>\/etc\/udev\/rules.d\/<\/code>, and you&#8217;ll need to do that as root. This directory is monitored by udev, so you don&#8217;t need to do any more than add the file. <\/p>\r\n<p><b>A note:<\/b> This line is for an ASUS device; if you&#8217;re using something other than an ASUS (a HTC or whatever) you&#8217;ll have to change 0B05 to the code for your manufacturer. You can look up the codes <a href = \"http:\/\/developer.android.com\/guide\/developing\/device.html#VendorIds\">here<\/a>.  <\/p>\r\n<p><b>Another note:<\/b> The &#8220;51-&#8221; in the filename is to do with the order in which the devices named in <code>\/etc\/udev\/rules.d<\/code> are processed; 51 is sort of in the middle of processing order. I&#8217;ve read in various places online that you might need a higher number (i.e. you might need to mount your android device last), so if none of this crap works, try renaming the file to <code>99-android.rules<\/code>.<\/p>\r\n<h3>4: Check that the device is now visible by adb<\/h3>\r\n<p>Go to the android SDK directory (or the appinventor directory if you&#8217;ve not installed the whole SDK). In the platform-tools subdirectory is adb, the &#8220;android debug bridge&#8221;. This is a client-server application that listens out for android devices. Type <\/p>\r\n<code>.\/adb devices<\/code>\r\n<p>If you see your device (there&#8217;s an ID number of a device) brilliant, it&#8217;s all worked. If you don&#8217;t, try killing the adb server using<\/p>\r\n <code>.\/adb kill-server<\/code>\r\n<p>and then try restarting the server <i>as root<\/i><p>\r\n<code>sudo .\/adb start-server<\/code>\r\n<p>This was the final key to my puzzle (in particular, running the adb server as root seemed to fix it for me), and I now have development apps on the screen of my eee pad. Let me know if it works for you.<\/p>","protected":false},"excerpt":{"rendered":"<p>This post details the steps I had to go through to get my eee-pad transformer Android tablet to talk to a linux machine running Ubuntu for development purposes. In particular, I&#8217;m trying to get it to run with AppInventor (a draggy-block-style easy programming environment). There are lots of FAQs and HOWTOs on the net out there, but the straightforward instructions didn&#8217;t work for me so I&#8217;m putting the things I&#8217;ve learned up here, in case someone else can benefit. I&#8217;m guessing this post won&#8217;t be of interest to you unless you&#8217;re trying to mess about with android, running Linux, and haven&#8217;t managed to get development<span class=\"more-link\"><a href=\"https:\/\/www.hannahdee.wales\/blog\/?p=783\">Read More &rarr;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[32,25,26,28,27,33,40,30,31,29],"class_list":["entry","author-admin","post-783","post","type-post","status-publish","format-standard","category-geekiness","tag-adb","tag-android","tag-appinventor","tag-eee","tag-eeepad","tag-geek","tag-geekiness","tag-linux","tag-ubuntu","tag-udev"],"_links":{"self":[{"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=\/wp\/v2\/posts\/783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=783"}],"version-history":[{"count":6,"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=\/wp\/v2\/posts\/783\/revisions"}],"predecessor-version":[{"id":789,"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=\/wp\/v2\/posts\/783\/revisions\/789"}],"wp:attachment":[{"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hannahdee.wales\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}