2015. május 22.

Connection the Ubuntu Phone to the Ubuntu Desktop

Sadly, if you connect the Ubuntu Phone with an USB cable to the Ubuntu Desktop PC, it just might not show up in Files/Nautilus.

On Ubuntu 14.04 the problem can be solved by installing the latest libmtp on the Ubuntu Desktop.
As written in this askubuntu answer:
sudo add-apt-repository ppa:fossfreedom/libmtp
sudo apt-get update
sudo apt full-upgrade

On Ubuntu 12.04 it is not this easy.

To install the latest libmtp, use these commands instead of the above:
sudo add-apt-repository "deb http://ppa.launchpad.net/fossfreedom/libmtp/ubuntu trusty main" 
sudo add-apt-repository "deb-src http://ppa.launchpad.net/fossfreedom/libmtp/ubuntu trusty main"
sudo apt-get update
sudo apt-get dist-upgrade

However, the Ubuntu Phone still not shows up in Nautilus.
But it is definitely recognized in lsusb:
~$ lsusb
Bus 001 Device 004: ID 2a47:2008 

ADB: an alternate way

An alternate way to reach the phone in with the Android Debugging Bridge (adb).
Install adb, if you don't have it yet:
sudo apt-get install android-tools-adb 

To be able to use the adb with the Ubuntu Phone, turn on Developer Mode on your phone.
Go to 'Apps > System Settings > About this phone > Developer mode' and turn it on. You'll have to set a Lock security first if you use Swipe only to unlock your phone.

As written in this askubuntu post, you'll have to add the phone vendor manually to the list adb recognizes, and then restart the adb-server:
printf '0x2a47\n' > ~/.android/adb_usb.ini
sudo adb kill-server;  sudo adb start-server

Now the Ubuntu Phone is recognized by adb:
~$ adb devices
List of devices attached 
JU013288 device

Usage of adb:
As a regular user, you'll probably just want to move files around.
This can be done with the push and pull commands.
Push copies a specified file from your computer to the phone.
adb -d push <local> <remote>
For example:
adb -d push ~/Music/testfile.mp3 Music/
Pull copies a specified file from the phone to your computer.
adb -d pull <remote> [<local>]
For example:
adb -d push Music/testfile.mp3 ~/Music/
List files and directories of your phone:
~$ adb -d shell ls
Documents  Downloads  Music  Pictures  Videos

~$ adb -d shell ls Music/
testfile.mp3

Mass-copy files with adb:
With adb it is impossible to mass-copy files. There is a sync option, but it only updates files that already exist, and copies none.
Alternate ways are script and tools based on adb, for example:

2015. május 20.

Ubuntu Phone Support and Bug Reporting

Before reporting bugs, always search for the bug you want to report. It is probably already known, and you only have to add yourself to it.
Check for reported bugs on the right side column on this site:
https://wiki.ubuntu.com/Avengers

First bugs:

Getting Started with the Ubuntu Phone

Some essential knowledge



Ubuntu Touch is the operating system of the Ubuntu Phone.
 
Read the Help!
Definitely read the Help! It can be downloaded from the Store.
Also read the FAQ for info like dual booting Ubuntu with Android on your phone, and that you cannot install GUI based Ubuntu Desktop applications on the Ubuntu Touch/Phone, because the GUI is different.

What is the difference between Scopes and Apps?
If I understand correctly, Scopes are made for showing content to the user, and making search easier.
Compared to Scopes, if I understand correctly, only Apps allow the user to both receive and share content, while Scopes only allow to receive.
For example: you have the Instagram scope this day, in which you can view other people's Instagram images. But you do not have the official Instagram application, so you cannot make new Instagram images and you cannot upload them to Instagram.

What is the difference between WebApps and Apps?
WebApps are simply a website optimized for viewing on the Phone. They looks like an App, but they are really not, mainly because they mostly lack integration with the phone. (i.e. share options)

Not all Ubuntu Phone Core Apps are preinstalled:
You have to install manually from the App Store:

  • File Manager
  • Document Viewer
  • Calendar
  • Terminal

Reporting Bugs of the Phone:
http://askubuntu.com/questions/602162/how-should-i-report-bugs-in-my-bq-ubuntu-phone
refers to: https://wiki.ubuntu.com/Avengers

PC-accessible AppStore content:
https://uappexplorer.com/

Copying files to and from the phone:
Through Nautilus/Files only Documents, Downloads, Music, Pictures and Videos folders are reachable. If nothing happens when you connect your phone, try this.
An alternate way to push and pull files is using ADB, which is an android development tool. If you have trouble getting the device recognized, try this. Developer mode has to be enabled to reach the device with ADB. (And here's how to set up ssh connection)

The Starting Sites for Developers:
http://www.ubuntu.com/phone/developers
http://developer.ubuntu.com/en/
More on Scopes: https://developer.ubuntu.com/en/scopes/
More on Apps: https://developer.ubuntu.com/en/apps/

2015. május 18.

Welcome to the Ubuntu Phone

I got my hands on a BQ Aquaris E4.5 Ubuntu Edition.

This is the hardware specification:

Screen
  • Screen size: 4,5"
  • Screen Technology: Capacitive IPS multi-touch screen with 5 simultaneous-detection points
  • Screen resolution: qHD 540 x 960 px, 220 HDPI
  • Aspect ratio: 16:9
  • Viewing angle: 178º
  • Others: Dragontrail Protection Glass
Memory
  • Internal mechanics: 8 GB eMMC
  • Expandable memory: Via microSD™ card (up to 32 GB)
Battery
  • Battery: LiPo 2150 mAh
Supported Formats
  • Video formats: .avi, .mkv, .mov, .mp4
  • Audio formats: .mp3, .ogg, .wav
  • Image formats: .bmp, .gif, .jpeg, .png
  • Text formats: .pdf, .txt
Dimensions and weight
  • Weight: 0.1230
  • Dimensions: 137 x 67 x 9 mm
Operating System
  • OS: Ubuntu
Connections
  • Connections: 3.5 mm headphone jack, Dual Micro-SIM
Functions
  • Functions: Ambient noise cancellation, FM radio, Microphone, Notification LED, Proximity sensor
Processor
  • RAM: 1 GB
  • CPU: Quad Core Cortex A7 up to 1.3 GHz
  • GPU: Mali 400-MP2 up to 500 Mhz
Camera
  • Front camera: 5 Mp
  • Rear camera: 8 MP with autofocus and flash
Connectivity
  • Bluetooth: Bluetooth®
  • Wi-Fi: Wi-Fi™ 802.11 b/g/n
  • 3G: 3G + (HSPA+/UMTS/GSM)
It has 2 Micro SIM slots, so the first thing to do was to cut down my regular sized SIM card to a MicroSim.
Here's how: http://smartphones.wonderhowto.com/how-to/cut-your-sim-card-down-mini-micro-nano-size-0149154/

I changed from using Android, and everything is looking good so far:
  •  I could set up Google accounts for Mail and Contacts sync
Here's the problems I ran into:
  • Q: Google Calendar is not present to sync. How to change this?
    this post shows that there could be a checkbox for Calendar, but I see none.
    • A: Have to install Calendar Application from Store first. Then it is possible.
  • Q: GPS location is off by 30 km. How to make it more exact? GPS is not really working, i.e. 'Here' cannot find my location.
    • A: this solved itself after some time.
  • Bluetooth is either turned off or discoverable. How to set it hidden, while keeping it turned on?
  • Q: How to set the Weather measurements to Celsius and meter on the Today scope? Why is it in Fahrenheit?
    • A: This depends on the Region you set for your phone. English (US) will use imperial and Fahrenheit, and English (UK) will use metric and Celsius.
    • This probably changes the Spelling auto-correction too, but I will not use it anyway.
Some of my essential apps I would want to use on Ubuntu Phone too:
  • Facebook messenger
    • opening m.facebook.com/messages in the browser is a huge help
  • Google Tasks
  • Google Keep
After the first afternoon with the dual SIM UbuntuPhone I quickly went back to using the previous Android device for The Phone For Work, as my professional life requires the usage of a variety of stable Android apps, which UbuntuPhone currently cannot provide.

However, as my private phone, Ubuntuphone will probably be a lot of fun :)

Ideas to check out:
  • Android emulator for UbuntuPhone
  • Python and Bash: what is possible on the phone with scripts?
  • General knowledge on the dev possibilities
  • Installing desktop apps like Facebook Messenger
  • Creating Web Apps like Facebook Messenger
Some interesting links on development and dev tools and so on:

2015. április 30.

color to grayscale PDF

The source file:
a PDF with page size US letter portrait
with text layer (different color and text background varying)
with color images as background (many images sum up to one background picture

The quest: convert the source PDF to:
a PDF with page size A4 portrait
with or without text layer (flatten or not - but keep text readable)
with grayscale and/or black and white (but recognizable) images as background

The purpose: print out the pdf on a regular black-and white printer:
keep it readable, and esthetically enjoyable
do not use more ink than necessary

***
The routes I tried:

1.) (from under the text layer) extract images, convert images, put images back.

Toolkit:

Extract images:
pdf2htmlEX --embed cfijo example.pdf

Convert images:
mogrify -type Grayscale -format ps *.png

...convert back to pdf with ps2pdf, join with pdfjoin or pdftk

Extract text layer:  
cpdf -draft example.pdf -o example_text.pdf

Put background images behind text layer:
pdftk  example_text.pdf multibackground example_images.pdf output modified.pdf


2.) flatten PDF to images, edit images.

Toolkit:

Burst pdf to single pages:
pdftk example.pdf burst

Convert to PostScript:
pdftops (and not pdf2ps)

Flatten ps to pnm and edit image
mogrify -format pnm -density 200x200 -type grayscale *.ps

...convert back to pdf with ps2pdf, join with pdfjoin or pdftk



***
In the end I chose the second route, because I had some trouble with the fonts in the pdf, which were not exported properly, and left a black text box in the images (making the text unreadable after backgrounding back to pdf)

Also the first route would involve a lot of learning of the PDF structure, the layer manipulation, and so on.

2015. április 26.

How to turn off ubuntu overlay scrollbar

https://www.liberiangeek.net/2012/03/disable-ubuntu-overlay-scrollbars-in-ubuntu-12-04-precise-pangolin/

~$ gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false

This can be set by hand in dconf editor:

org > gnome > desktop > interface > ubuntu -overlay-scrollbars [remove checkmark]

2015. április 8.

Command Line alternative to Safely Remove Drive

Recently my external USB drives (HDD, Pendrive, Kindle, mobile phone) stopped detaching itself after unmount.
Obviously I would not plug out a HDD with 750GB data that is still spinning. But it does not want to stop at all. I can mount and umount it and it is still spinning. (Or whatever these new drives does instead of spinning)

So the solution is to do the command line equivalent of safely remove in two steps:
1. unmount
2. detach

The solution I found on askubuntu:

For a practical example, if I have the partition /dev/sdb1 mounted, I would run this to unmount and detach it:
udisks --unmount /dev/sdb1
udisks --detach /dev/sdb