Tuesday, July 24, 2012

How to connect to unknown android device using USB

>adb devices
List of devices attached
emulator-5554    device
????????????    no permissions

which means this device is unknown to adb yet.

try to find it is device id
>lsusb
Bus 001 Device 006: ID 19d2:0287 ONDA Communication S.p.A.

19d2 is the vendor id, 0287 is the product id.

>sudo /etc/udev/rules.d/51-android.rules
add a new entry at the end with vendor/product id above

>sudo restart udev

>adb kill-server
>adb start-server
>adb devices
List of devices attached
emulator-5554    device
04507242439fb497_MTPADB    device

Sunday, March 4, 2012

vim indent commands

>> Indent line by shiftwidth spaces
<< De-indent line by shiftwidth spaces
5>> Indent 5 lines
5== Re-indent 5 lines

>% Increase indent of a braced or bracketed block (place cursor on brace first)
=% Reindent a braced or bracketed block (cursor on brace)
<% Decrease indent of a braced or bracketed block (cursor on brace)
]p Paste text, aligning indentation with surroundings

=i{ Re-indent the 'inner block', i.e. the contents of the block
=a{ Re-indent 'a block', i.e. block and containing braces
=2a{ Re-indent '2 blocks', i.e. this block and containing block
>i{ Increase inner block indent

Monday, January 2, 2012

ptrace: Operation not permitted

I got above error when try to use Eclipse CDT to attach an running process for debugging.

It because of the ptrace protection since Ubuntu 10.10.

Here is the link to more detail explain
https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace%20Protection

To work around:
first need to enable root account
>sudo passwd root
>su
>echo 0 > /proc/sys/kernel/yama/ptrace_scope
>exit
re-disable root account for security reason
>sudo passwd -dl root

Now, it works

To permanently allow it edit /etc/sysctl.d/10-ptrace.conf and change the line to:
kernel.yama.ptrace_scope = 0