[HOWTO] connect Porteus to Android device

Post tutorials, HOWTO's and other useful resources here.
Post Reply
aus9

[HOWTO] connect Porteus to Android device

Post#1 by aus9 » 31 Oct 2015, 06:38

This is a mini-howto to show you how to create an udev rule so you can use adb or fastboot commands from the
package android-tools to "talk" to your Android phone or Tablet via the command line.

Porteus stuff first
###################

As a local user or for those who login as root run this command with a usb data cable connected to your phone.
There is no need at this stage to enable USB debugging on Android. That can be done later.

Code: Select all

lsusb
My result is (culled of non-phone/tablet)
ID 0bb4:0c02 HTC (High Tech Computer Corp.) Dream / ADP1 / G1 / Magic / Tattoo (Debug)

Maker ID is a lie but lots of Chinese phones use other maker ID so lets move on.
Be careful if you manually type ids. Best to copy and paste, mine is (zero)bb4 not (Oh)bb4.

If you login as root.....skip this next part to add guest to the plugdev group.
Now run this command

Code: Select all

groups
My results
guest disk lp floppy dialout audio video cdrom games power netdev scanner vboxusers users

we need to add ourselves, using root powers, to the plugdev line in /etc/group so it reads
plugdev:x:83:guest
My number 83 may not be the same as yours. Just append guest. Reboot to test groups commands

All users guest or root rejoin here
####################################
Now use root powers to create the udev rule.
I will do this by command as we need to do extra command in a terminal as well.

Code: Select all

echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="666", GROUP="plugdev" 
' > /etc/udev/rules.d/55-0bb4.rules
If commands scare you, run a root powered text editor like leafpad, mousepad or kate.

Note that we have used a single quote as there are double quotes in the text file we are creating
Change the name of "0bb4" to anything you like but most people have only one phone??

Don't forget to change 0bb4 to your actual maker ID

Now either do a full reboot or try to update that rule live by running as root

Code: Select all

udevadm control --reload-rules
I am on 64 bit but we need android-tools so use usm to search/install for your package as root

Code: Select all

usm -g android-tools
There should be only one result so install it please and it should activate as well.

Now as local or root user do 2 commands please

Code: Select all

adb kill-server
adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
my result may be one of 2 main types
???????????? no permissions
or
0123456789ABCDEF unauthorized

If you get a serial number and a device, then you are already set up and can skip the next section

lets look at your device
Android
######

First ensure you have USB debugging turned on.
for me, settings -> Developer Options -> Section Debugging -> button for USB debugging.

If you can't find Developer search the internet how to get it, for most devices try this
settings -> about phone -> build number tap this about 7 times

USB debugging MUST I repeat must be turned on.

2) Older devices may not have any extra security but mine is nicer.

so for newer phones you will get a notification to allow a PC with a certain
fingerprint access to your Android. Naturally I choose yes. Note this is Android
notification about your PC.

Image

PC
#####

repeat command

Code: Select all

adb devices
List of devices attached 
0123456789ABCDEF	device
If you can not get any serial number, I suggest you post on the XDA forum.

Its beyond the scope of this tutorial on how to use adb or fastboot but I will just
show one command and result

Code: Select all

adb pull /storage/sdcard0/nfc.txt
8 KB/s (746 bytes in 0.082s)
cat nfc.txt 
/storage/emulated/legacy/nfc.txt
/storage/emulated/0/nfc.txt
/mnt/shell/emulated/0/nfc.txt
/system/etc/nfcse.cfg
/system/etc/nfcee_access.xml
/system/etc/nfc.cfg
/system/etc/permissions/com.android.nfc_extras.xml
/system/etc/permissions/android.hardware.nfc.hce.xml
/system/etc/permissions/android.hardware.nfc.xml
/system/lib/libnfc_ndef.so
/system/lib/libmtknfc_dynamic_load_jni.so
/system/lib/libmtknfc.so
/system/lib/libem_nfc_jni.so
/system/lib/libnfc_mt6605_jni.so
/system/framework/com.android.nfc_extras.jar
/system/framework/com.android.nfc_extras.odex
/system/xbin/nfcstackp
/data/misc/nfc_conformance
/data/data/com.mediatek.nfc.dta
/data/data/com.android.nfc
/data/data/com.mediatek.nfc.sysoper
/data/media/0/nfc.txt
/data/nfc_socket
YMMV

aus9

Re: [HOWTO] connect Porteus to Android device

Post#2 by aus9 » 03 Jan 2016, 23:02

this is just a test of image restrictions and a translation of the factory mode screen seen on some phones

Image

User avatar
brokenman
Site Admin
Site Admin
Posts: 5575
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: [HOWTO] connect Porteus to Android device

Post#3 by brokenman » 04 Jan 2016, 22:22

Holy crap! I forgot why I love linux sooo much. Nothing like a challenge when you want to do something as simple as plug your god damn phone in. I'm lucky I only use my cell phone to actually call people, and keep an agenda. I think if i need to transfer files I will use bluetooth.

Thanks for putting this together. It will be useful for the digital native generation.
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: [HOWTO] connect Porteus to Android device

Post#4 by aus9 » 09 Jan 2016, 07:19

this is an update for those testing Nemesis

android tools won't use usm. I prefer a full injection rather than a module

Code: Select all

sudo pacman -S android-tools

(run as local user)adb devices
List of devices attached 
0123456789ABCDEF	device
 

aus9

Re: [HOWTO] connect Porteus to Android device

Post#5 by aus9 » 09 Jan 2016, 07:24

My device does not have a dumchar_info but it does allow me to do this

Code: Select all

adb shell
shell@H560:/proc $ cat partinfo                                                
Name             Start           	Size            
pgpt             0x0000000000000000	0x0000000000080000
proinfo          0x0000000000080000	0x0000000000300000
nvram            0x0000000000380000	0x0000000000500000
protect1         0x0000000000880000	0x0000000000a00000
protect2         0x0000000001280000	0x0000000000a00000
seccfg           0x0000000001c80000	0x0000000000040000
lk               0x0000000001cc0000	0x0000000000060000
boot             0x0000000001d20000	0x0000000001000000
recovery         0x0000000002d20000	0x0000000001000000
secro            0x0000000003d20000	0x0000000000600000
para             0x0000000004320000	0x0000000000080000
logo             0x00000000043a0000	0x0000000000800000
expdb            0x0000000004ba0000	0x0000000000a00000
tee1             0x00000000055a0000	0x0000000000500000
tee2             0x0000000005aa0000	0x0000000000500000
metadata         0x0000000005fa0000	0x0000000002060000
system           0x0000000008000000	0x0000000052000000
cache            0x000000005a000000	0x0000000007000000
userdata         0x0000000061000000	0x0000000341d80000
flashinfo        0x00000003a2d80000	0x0000000001000000
sgpt             0x00000003a3d80000	0x0000000000080000
Now I can start to have a look at a flash tool scatter file and see if I have a correct start position and size
https://www.dropbox.com/s/3coh213z7e2ar ... r.txt?dl=0

by comparing them....I find the mismatch begins with
partition_index: SYS19--------------------------error
partition_name: userdata
file_name: userdata.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0x61000000
physical_start_addr: 0x61000000 61000000
partition_size: 0x49c00000 341d80000
and because the size is different the 2 next partitions also have changed start positions

verdict not good enough to try flashing with this scatter file unless I risk a format and change the last 3 partitions

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: [HOWTO] connect Porteus to Android device

Post#6 by Bogomips » 12 Feb 2016, 22:51

brokenman wrote:Thanks for putting this together. It will be useful for the digital native generation.
There was a time not so long ago, when if one was sitting in a public place like a cafe, you would see people sitting down to table, and especially couples, taking out their cigarette packets and putting these in front of them on the table. Now it's no longer cigarette packets, but smartphones and the like. It's the new habit! :evil:
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

aus9

Re: [HOWTO] connect Porteus to Android device

Post#7 by aus9 » 13 Feb 2016, 00:14

offtopic but even better observe that young people now sit at coffee table texting other people instead of chatting to their friend.

Post Reply