Sunday, December 2, 2012

Getting Android adb working with Pipo Smart S1



The Pipo Smart S1 is a 7" Android 4.1 tablet that costs under $100.  It works great and is quite fast.   It's comparable to the Nexus 7" at half the price.  I changed the firmware to rev3 with instructions from TopNotchTablets.  This download also got rid of the apps that had Chinese language, giving a more comfortable user experience.

The CPU is a Rockwell RK3066 1.6GHz chip.

Rooting the tablet and upgrading the firmware was fast and painless.

Getting the tablet to work with the Android Debug Bridge (adb) was trickier.

Pygame Subset for Android (PGS4A) relies on adb that is included in the platform-tools sub-directory of the Android SDK.




When I first connected the Pipo Smart S1 tablet to my Ubuntu box with a micro USB cable, the build worked, but the install failed.

After figuring out how to use adb, I started to use adb devices to see the connected devices.  It wasn't detecting the tablet.


I found out that adb needs a USB Vendor ID to work properly.  Pipo wasn't listed as a vendor.   I found that the Vendor ID for the RK3066 chip is 0x2207.

Using the Android Developer documentation on Hardware Devices, I created the file /etc/udev/rules.d/51-android.rules and inserted this:


SUBSYSTEM=="usb", ATTR{idVendor}=="0x2207", MODE="0666", GROUP="plugdev"

It still wasn't working for me.  I had USB debugging enabled on my tablet.

I then added the vendor ID code to ~/.android/adb_usb.ini

:~/.android$ cat adb_usb.ini 
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2207

It's still not happening.  I check out lsusb and see some hope that the device is detected.  




I turn off wifi from the tablet.

I run adb devices again.


$ ./adb devices
List of devices attached 
???????????? no permissions


There's a bit more life.  I run it again as sudo.

$ sudo ./adb devices
[sudo] password for craig: 
List of devices attached 
???????????? no permissions

No go.

I kill the server. Then start it as root.
$ sudo ./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
ZX7U17M3NX device

It found the device!

I build the Python app:

$ ./android.py build dad/dad_image release install

install:
     [echo] Installing /home/c/Documents/python/pgs4a-0.9.4/bin/dad_image-1-release.apk onto default emulator or device...
     [exec] 5391 KB/s (2741472 bytes in 0.496s)
     [exec] pkg: /data/local/tmp/dad_image-1-release.apk
     [exec] Success

BUILD SUCCESSFUL
Total time: 8 seconds

It looks like the build succeeded.  

Here's a screenshot of the game running on the Pipo Smart S1, transferred using a USB cable with adb.





After I got this working, I worked with my son, my only computer programming student,  to get a similar game working on his LG Optimus S phone.  The main learning points today:

  • using .append to fill a list of objects.   The list target_group contains all the enemies and all the bombs.
  • Set up triggers based on elapsed time use list slicing to control the number of targets on the screen.







After I wrote the blog post, I also found this  on slatedroid.com.  It covers many of the same steps.  I'm not sure if shutting off WiFi is needed.  The person below also seems to have adb working without having to run the adb server as root.  I may fiddle around with more things in the future.  The main thing is that I can connect my tablet to adb in debug mode and install the apk files easily.


Posted 21 November 2012 - 08:31 PM
Just a few tips to those are trying to connect to a RK3066 via ADB on linux.

  • Download & Install SDK
  • Edit udev rules (see step #3), the RK3066 Vendor ID is 2207
  • Restart udev (udevadm control --reload-rules)
  • Edit $HOME/.android/adb_usb.ini, add 0x2207 at the end of the file
  • Restart adb server (adb kill-server && adb start-server)
  • Plug & List your device (adb devices)


At step #2, you should get something like this
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"


At step #4, you should get something like this
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2207

10 comments:

  1. More attempts to solve the battery drain problem. Trying to test battery life by disabling the mediascannerReceiver.

    $ sudo ./adb kill-server
    $ sudo ./adb start-server
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    $ sudo ./adb devices
    List of devices attached
    1U2AKWDKQT device

    $ sudo ./adb shell
    root@android:/ # su
    s.media/com.android.providers.media.MediaScannerReceiver <
    Component {com.android.providers.media/com.android.providers.media.MediaScannerReceiver} new state: disabled
    root@android:/ #
    130|root@android:/ #

    ReplyDelete
  2. The copy and paste didn't work on the comment above.

    It should be

    pm disable com.android.providers.media/com.android.providers.media.MediaScannerReceiver

    ReplyDelete
  3. Better yet, here's a YouTube video that explains how to disable MediaScannerReceiver.

    http://www.youtube.com/watch?v=fNhJ1DxKolE

    I'm still not sure if this will improve battery life. The information on the forums seems to indicate that there is a corrupt media file on my SD Card. As I've had this same problem with different micro SD Cards, I'm not sure if this is the source of the problem.

    ReplyDelete
  4. I wiped the OS on the tablet and installed a new clean version. I no longer have the battery drain issue. I think that there was an application that was sucking down the battery.

    ReplyDelete
  5. http://free-tutorials.org/connect-and-debug-your-android-application-with-one-function-under-linux-os/ read this , maybe is need to start with a root account ... will find more about android development .

    ReplyDelete
    Replies
    1. Catalin, appreciate the link to the tutorial. thanks.

      Delete
  6. Dimuthu, glad that it worked. I'm using my Pipo Smart S1 every day. It's a nice little tablet. It's pretty fast for the price. I really think that Android is the way to go.

    ReplyDelete
  7. Thank you! Thank you! Thank you!
    I tried for two days to connect my to tablet from Eclipse. Following your instructions got me connected in ten minutes.

    ReplyDelete
    Replies
    1. Jolly, Glad that it worked out for me. Thanks for the nice comment. I'm still using my tablet almost every day. It's a nice little product for the low cost. I got it over a year ago and there's probably cheaper or more powerful models out this year.

      Delete