Monday, January 20, 2014

MTP file system setup for linux (Android device, mounted automatically)


Linux MTP setup
On a Linux install, things aren't quite as easy.  On the plus side you have a bit of control how things are mounted, but there's no one click solution.  Don't be discouraged, you can have MTP set up and running in no time with a bit of terminal command fun.  Here's a walkthrough for using the Galaxy Nexus with Ubuntu:
Set up a UDEV rule via the terminal by opening the rules file
sudo nano -w /etc/udev/rules.d/51-android.rules
And entering the following line at the end of the file (be sure to use your user name at the end!):
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<your-username>"
Now install the tools and set a mount point by entering the following commands one line at a time
  • sudo apt-get install mtpfs
  • sudo mkdir /media/GNexus
  • sudo chmod 775 /media/GNexus
Plug your Galaxy Nexus in, and enter the next line in the same terminal window:
sudo mtpfs -o allow_other /media/GNexus
Drag and drop through Nautilus, and when you're done and need to unmount, enter the following:
sudo umount mtpfs
This will have to suffice until someone writes a couple scripts or a front end.  You don't have to install mtpfs, make the mount point, or chmod it after the first time.  You may have to mount the device manually each time, I'll know more when I get one to play with. 

ADB mode tricks

Screen recording with adb

adb shell screenrecord /sdcard/filename.mp4 
Save the file to the device SDcard and press ctrl+c to stop recording.
Here is a video on a easy way to screen record. VIDEO


WHAT IS A LOGCATLogcat is the command to view the internal logs of the Android system. Viewing logs is often the best way to diagnose a problem, and is required for many issues. This way you'll find out what apps are doing in the background without you noticing.

Now type this in the terminal 
adb devices (note) to make sure devices is connected
adb logcat -v long > logcat.txt
adb logcat > logcat.txt:

ADB Commands

ADB Commands
adb devices - list all connected devices
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward <local> <remote> - forward socket connections forward specs are one of: tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] [-s] <file> - push this package file to the device and install it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
('-s' means install on SD card instead of internal storage)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
adb bugreport - return all information from the device
that should be included in a bug report.
adb help - show this help message
adb version - show version num
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
< tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
< localdir> can be interpreted in several ways:
- If <directory> is not specified, both /system and /data partitions will be updated.
- If it is "system" or "data", only the corresponding partition is updated.

environmental variables:
ADB_TRACE - Print debug information. A comma separated list of the following values
1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connect to. -s takes priority over this if given.
ANDROID_LOG_TAGS - When used with the logcat option, only these debug tags are printed 

FAstboot commands:

Fastboot Commands
Quote: Example (fastboot flash recovery TWRP-recovery.img) then hit enter this will flash a recovery image to the device.
usage: fastboot [ <option> ] <command>
update <filename> reflash device from
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it
devices list all connected devices
reboot reboot device normally
reboot-bootloader reboot device into bootloader
-w erase userdata and cache
-s <serial number> specify device serial number
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address
-n <page size> specify the nand page size. default: 2048

Galaxy Note 2 info

No comments:

Post a Comment