Month: July 2019

How to recover your data from Android when your LCD screen damage

Few days ago my Moto Z Play fell to the floor and the LCD screen became black. I couldn’t see the screen anymore.

Unfortunately when I plug my phone over USB cable to computer, nothing appears. It is because Android wait for user to select what USB function it needs to use (MTP, ADB, etc). Because I can’t see the screen it is not possible to select any option.

Searching in the internet for some tips how to solve this issue I found a nice tip from Olivia Henry: https://www.youtube.com/watch?v=tAChemeSbgo

Again I cannot use her suggestion because ADB is not enabled when I plug the cable to computer.

Then I remembered that I have an antitheft software called Cerberus installed on my phone. I just when to https://www.cerberusapp.com/dashboard and did the login in the system.

I selected the “Start Shell” and pressed Volume Down + Power button on the phone and listened the “take pictures” click sound.

Let see if we got some donuts:

$ cd /sdcard/Pictures/Screenshots

u0_a138@addison:/sdcard/Pictures/Screenshots $

u0_a138@addison:/sdcard/Pictures/Screenshots $ ls

Screenshot_20190724-142918.png

u0_a138@addison:/sdcard/Pictures/Screenshots $ mv Scree* screen.png

u0_a138@addison:/sdcard/Pictures/Screenshots $ ls

screen.png

u0_a138@addison:/sdcard/Pictures/Screenshots $ od -t x1 -v screen.png > screen.txt

u0_a138@addison:/sdcard/Pictures/Screenshots $ cat screen.txt

0000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52
0000020 00 00 04 38 00 00 07 80 08 02 00 00 00 a4 03 70
0000040 5d 00 00 00 03 73 42 49 54 08 08 08 db e1 4f e0

Then I selected all the text starting from “0000000 89…” until the last line at bottom, copied and paste it on text editor on computer and saved it as screenshot.txt.

Because I don’t want offset at beginning of each line, I removed it:

$ sed -i ‘s/^(.){8}//g’ screenshot.txt

And finally converted the text bytes to binary using this command:

$ for i in $(cat screenshot.txt) ; do printf “\x$i” ; done > screen.png

So using this trick I could access my phone again to backup some important files.

Getting the Serial Port working on WINE 4.0

I already used serial port on windows program running on Linux using wine: https://acassis.wordpress.com/2014/10/05/how-to-install-x-ctu-on-linux-using-wine/

But unfortunately the symbolic link ~/.wine/dosdevices/com1 pointing to /dev/ttyUSB0 was not working.

After spending some hours trying to fix this issue I found the solution! I need to run “wine regedit” and create a string entry named “COM1” with the value “/dev/ttyUSB0” inside HKEY_LOCAL_MACHINE\Software\Wine\Ports.

I found this solution thanks to this post: https://www.scivision.dev/wine-serial-port-links/

Running Chronometer demo on STM32LDiscover

Enter inside your NuttX Workspace, i.e.:

$ cd nuttxspace/

Enter inside /nuttx and update it:

$ cd nuttx/
$ git pull

Go to /apps directory and update it:

$ cd ../apps/
$ git pull

Return to /nuttx and clear the repository:
$ cd –
$ make distclean

Configure the stm32ldiscovery to use the chrono board profile:

$ ./tools/configure.sh stm32ldiscovery/chrono
Copy files
Refreshing…

Compile it:

$ make

Flash the Firmware:

$ openocd -f interface/stlink.cfg -f target/stm32l1.cfg -c init -c “reset halt” -c “flash write_image erase nuttx.bin 0x08000000”

Open other terminal and execute:

$ ./tools/ocdconsole.py

Return to previous terminal and execute:

$ openocd -f interface/stlink.cfg -f target/stm32l1.cfg

You should see the NuttX Shell starting in the other terminal:

$ ./tools/ocdconsole.py
==Link Activated

NuttShell (NSH)
nsh>

Just type “help” or “?” to see if chrono app is there if so run it:

nsh> ?
help usage: help [-v] []

? echo exit hexdump ls mh sleep xd
cat exec help kill mb mw usleep

Builtin Apps:
chrono slcd
nsh> chrono
Opening /dev/slcd0 for read/write access
Attributes:
rows: 1 columns: 6 nbars: 4
max contrast: 7 max brightness: 0
button_daemon: Running
button_daemon: Opening /dev/buttons
button_daemon: Supported BUTTONs 0x01

Non-Linux FOSS

“Linux continues to make headway in embedded devices, but for many devices, it’s just too heavy, and out of the box, it doesn’t have real-time support.

NuttX is a Real Time Operating System (RTOS) for small- to moderate-size embedded systems. It strives to be standards-compliant (POSIX and ANSI) to the fullest extent possible for a deeply embedded environment. NuttX is fully preemptible and includes a filesystem, C library, networking and USB device support.

NuttX has been ported to numerous platforms/architectures ranging from small 8-bit systems, such as the 8052 and the M68HC12, to larger 32-bit systems, such as the ARM Cortex-M3. NuttX can be built with Linux and with Cygwin. Depending on the options that are enabled, NuttX can be squished down to around 20K or so. Around 50K gives you room for a full-featured build.

NuttX was first released in 2007 and is actively developed. It has had 49 releases since then and currently is at version 5.2. NuttX is hosted on SourceForge at nuttx.sourceforge.net and is licensed under a BSD license.”

Thanks these 4 paragraphs in the Linux Jornal I discovered NuttX almost 9 years ago ( https://www.linuxjournal.com/article/10785#mpart4 ) ! I still enthusiastic about Linux even after 20 years using it, but it was NuttX that took my heart.

I’m talking it because in exactly 7 days (or one week) we will have our first NuttX International Workshop:

See you my friends there!