QA SoftVision Team/Mobile/Pandaboard setup

From MozillaWiki
Jump to: navigation, search

Information

  • This is a basic guide to setting up the pandaboard in order to access it for automation.
  • Here you can find more information on setting up a pandaboard

Android build installation

  • Make sure you have a 8GB SDCard of Class 10 for the board
  • Download the image from here
  • Unzip the image making sure it's size is 16GB when done
  • Connect the SDCard to the PC using the apropriate hardware (an internal or external card reader)
  • Wait for the card to be mounted
  • Run "df" from the terminal to get a list of devices and check the id of the sdcard - should be similar to /dev/sd<x><nr> (for eg /dev/sdd1)
  • Unmount the SDCard
sudo umount /dev/sd<x><nr> -> for e.g. umount /dev/sdd1
  • Run the above command for each partition of the SDCard if there are multiple
  • Go to the folder you extracted the image in and run
sudo dd if=panda_v2_16gb.img of=/dev/sdd bs=100M count=8000
  • Take out the SDCard and put it in the panda board, connect the board and wait for Android to load

Board setup

  • Notes:
    • The available Android installation does not support video output so you will not be able to use a monitor or a mouse
    • You can still use adb commands to launch apps and ddms to see screenshots
  • Setup:
    • Plug in the SD Card in the SD Card slot
    • Connect the internet cable to the internet port
    • Connect the Power Adapter cable
    • Connect the mini-USB cable

Android settings

  • Turn ON developer mode from the Settings menu - Development subsection
  • Turn ON the "Always On" option in the Settings menu - Development subsection. From adb on a rooted device:
#sqlite3 /data/data/com.android.providers.settings/databases/settings.db 
#sqlite> update system set value="-1" where name="screen_off_timeout"; 
#sqlite> .quit
  • Set the display turn off option to the maximum from the Settings menu - Display timeout
  • Allow the installment of apps from unknown sources
  • Notes
    • These settings are not needed with the Android image provided in the Setup section

ADB settings

  • This section will help you set up your PC to access the pandaboard via the ADB interface
  • Step 1 - Enter sudo mode for the Terminal
$ sudo su
  <psswd>
  • Step 2 - Check if you have the .android folder created if not set it up now
$ mkdir ~/.android
  • Step 3 - If the folder was not created you also have to create the adb_usb.ini file
$ gedit ~/.android/adb_usb.ini
  • Step 4 - Add the device code to the adb_usb.ini configuration file so that adb will know the device
$ echo "0x0451" > ~/.android/adb_usb.ini
  • Step 5 - Make sure the code was added
$ cat /root/.android/adb_usb.ini
  0x0451
  • Step 6 - Restart the adb server
adb kill-server
adb start-server
  • Step 7 - Verify the device can be accessed
adb devices
  • If an identification number is displayed and you don't get a "no permissions" message the device is available
  • You can also add settings in the /etc/udev/rules.d/51-android.rules file (Note: sudo permissions are required to save the file - just run gedit in sudo when opening the file for edit)
Add the following line to the file replacing username with actual username:
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d102", MODE="0666", OWNER="<username>"

ADB commands that may help

  • Unlock the screen
adb shell input keyevent 82
  • Reboot device
adb reboot
  • Superuser shell
adb shell
su
  • Run a shell command in superuser mode - single line of code
adb shell su -c 'command'

or

adb shell command | su
  • Launch an app/ launch the SUTAgent - launch after stoping the app first
adb shell am start -S -a android.intent.action.MAIN -n com.mozilla.SUTAgentAndroid/.SUTAgentAndroid
  • Open the Apps tab from the Settings menu
adb shell am start -a android.settings.APPLICATION_SETTINGS
  • Device log and screenshot access - Screenshot UI accessed using Ctrl + S
ddms
  • Sqlite3 insert
 sqlite3 -batch /data/data/com.android.browser/databases/browser.db 'insert into bookmarks(title,url,bookmark) values ("b1","www.b1.com",1);' 
  • List all installed packages
adb shell pm list packages -f
  • Adb uninstall:
adb uninstall <package_name>

For default package names:

adb uninstall org.mozilla.roboexample.test
adb uninstall org.mozilla.fennec_root

Using the SUTAgent

  • Info
    • SUTAgent is an apk that offers the possibility to run commands on the device via a network connection without the need of an USB connection to the device
    • The SUTAgent is available only if the device is in the same network as the pc
  • Create a SUTAgent.ini.tmpl file (a template file)
  • In the file write the configuration similar to:
[Registration Server]
IPAddr = <Your pc ipaddress>
PORT = 20742
HARDWARE = Android Board
POOL = GENERAL
  • Update the SUTAgent.ini file
adb push SUTAgent.ini.tmpl /data/data/com.mozilla.SUTAgentAndroid/files/SUTAgent.ini
  • Restart the device
  • Make sure the SUTAgentAndroid apk was started and get the IP of the device from it
  • Telnet to the device to access the SUTAgent commands
telnet <device ip> 20701
  • Run "help" for a list of commands