Thursday, December 10, 2015

The OrangePI PC, a low cost alternative to the Raspberry PI.
A short review.

A few months ago I was browsing AliExpress, when I stumbled upon a product called OrangePi.
I searched the internet for information about it, and I immediately discovered its official website, which is www.orangepi.org (there also exists www.orangepi.com but it looks to be the website of a UK vendor of the same boards).

Well, what is an OrangePi? Of course, the name recalls the most famous SBC (single board computer) ever, the RaspberryPi, and this is not a coincidence, as the OrangePi is a chinese SBC, clearly inspired by the Raspberry.

As of now, there are 7 different Orange Pi models (ranging from "Mini" to "Plus 2"). The most interesting in my opinion is the "OrangePi PC". Why? For its aggressive price of only $15 plus shipping!

The hardware of this board is interesting:

CPU:
H3 Quad-core Cortex-A7 H.265/HEVC 4K

GPU:
·Mali400MP2 GPU @600MHz
·Supports OpenGL ES 2.0

Memory (SDRAM): 1GB DDR3 (shared with GPU)

Onboard Storage: TF card (Max. 64GB) / MMC card slot

Onboard Network: 10/100M Ethernet RJ45

Video Input:
A CSI input connector Camera:
·Supports 8-bit YUV422 CMOS sensor interface
·Supports CCIR656 protocol for NTSC and PAL
·Supports SM pixel camera sensor
·Supports video capture solution up to 1080p@30fps

Audio Input: MIC

Video Outputs:
·Supports HDMI output with HDCP
·Supports HDMI CEC
·Supports HDMI 30 function
·Integrated CVBS
Supports simultaneous output of HDMI and CVBS

Audio Output: 3.5 mm Jack and HDMI

Power Source: DC input

USB 2.0 Ports: Three USB 2.0 HOST, one USB 2.0 OTG

Low-level peripherals:
·40 Pins Header,compatible with Raspberry Pi B+
·GPIO(1x3) pin
·UART, ground.
So, as you can see, we basically have a quad core ARM CPU, with 1GB of RAM, 3 USB ports, and a fair graphics card.
What it lacks (other Orange Pi models have this and/or that) are onboard wifi, a gigabit ethernet port and eMMC, but of course we can't have everything at this price.

I've ordered the Orange Pi PC on Aliexpress, from the official manufacturer, and 3 weeks later I received a neat package containing the board, a usb power cable and a not-too-sturdy transparent plastic case. All this for less than $25 including shipping!

I've been using it for a couple of weeks and... what can I say?
The board could be very interesting if only the community behind it was bigger and more active. It definitely can't compare to the Raspberry Pi community as of yet.
The support from the manufacturer could be better, as the images of operating systems they provide are old and faulty, and the claim that Raspberry Pi images can be used for this board(s) is absolutely misleading since RasPi images are not compatible at all.
Luckily there is a member of the community, called loboris, who is very active and has released many OSes to be used on these boards, among which Debian, Fedora, Slackware, Arch Linux and others.

I'm currently running his build of Ubuntu MATE 14.04 and I have to say he has done a great work: it's easy to install, and apart from a few glitches here and there, it works very well.

My original intention was to use this board as a very low cost syncthing server/node, and that's exactly what I did.
After installing the aforementioned Ubuntu MATE, I've downloaded the latest ARM version of syncthing and installed it on the OrangePi PC.
(For those who don't know what it is, syncthing is an open source alternative to BTSync or -basically- a completely self-hosted Dropbox alternative).
It works great, it's very fast, and for the money I've spent I'm very satisfied, considering that I was also able to "redirect" the Raspberry Pi 1 model B I was using for this task to something more useful (a squeezebox player, actually).

Unfortunately, Linux does not have the proper drivers to take advantage of the GPU hardware acceleration, therefore using this board as an XBMC/Kodi mini HTPC is not a good idea (yet). Some people are working on it, and I really hope they succeed, because a $15 Kodi machine with the ability to render HD video would be HUGE!

At the moment, the only way to take advantage of the GPU is by installing Android, although the image provided is buggy and not very reliable.
Still, if you like to fiddle with new hardware and explore new possibilities, you might want to give it a chance.

In my opinion the OrangePi PC is a nice product, which lacks the necessary support from the manufacturer, who looks too busy releasing new boards instead of developing a good OS for the boards they have already sold.

The community is growing, but the official forum must be hosted on a very old server, since it's so sloooooow. I hope they will at least upgrade this.

Still, for $15 this board is a steal. I would definitely buy it again, although I would still limit its use to simple tasks. If you have complex projects in mind, you can't beat the Raspberry Pi world and community, and the price difference is not that big.



Tuesday, November 24, 2015

Slow shutdown/reboot when mounting CIFS/SMB shares on Ubuntu and derivatives

My laptop with Linux Mint 17.2 suddenly started taking full minutes for every reboot/shutdown. What might have caused it?

I then remembered I had previously placed some new entries in the fstab, since I needed to mount some remote CIFS shares. Could this be the culprit?

Well, it seems it was exactly that: there is a bug in Network Manager which shuts down before unmounting the network shares. This will cause CIFS to hang and wait for 60 seconds or so for every share.

Even though the Ubuntu Wiki says that this bug has been solved since version 12.04, I have applied the suggested solution and it worked.
Now the shutdowns/reboots happen in an instant!

So, is the bug back? I don't know, but what I know is that this is how to fix this problem:
sudo ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K14umountnfs.sh
sudo ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K14umountnfs.sh

Tuesday, March 10, 2015

How to install Huion graphic tablets on Linux


The graphic tablet market is basically dominated by Wacom, which makes very good tablets, but at a high price.

Enter Huion, a chinese company that manufactures cheap graphic tablets that are a good alternative to Wacom, especially for people who never used a graphic tablet before, or for those on a tight budget.

These graphic tablets all work on Windows and Mac OSX with the provided drivers (or -better- by downloading the latest version from Huion's website).

Linux users have to work a little in order to see their Huion tablet work under their beloved operating system. So here is a little how-to to solve this issue.

First of all, most Huion tablets are natively supported via kernel, starting from kernel version 3.17, therefore if you are using a kernel >=3.17, you shouldn't have any problem.

If you are using a kernel <3.17 you are going to need to follow these simple steps (instructions are valid for debian-based distros, like Ubuntu and its derivates):

1. Go to project DIGImend on GitHub;
2. Download the latest release of digimend-kernel-drivers
3. unzip/untar the downloaded package in a new directory (for example: ~/digimend )
4. open a terminal
5. make sure you have the appropriate linux-headers installed
sudo apt-get install linux-headers-`uname -r`
6. move to the directory where you have unzipped/untarred the drivers package:
cd ~/digimend
7. in the terminal give the command:
make
8. when it finishes give the command:
sudo make install

Ignore any "Can't read private key" messages that might show up. This won't be a problem unless you set up kernel module signature verification. But most people won't so, don't worry.

Now you can plug your Huion graphic tablet and enjoy using it under Linux.


Don't have a graphic tablet yet? Buy one now! 


Thursday, February 26, 2015

How to install Syncthing on your Raspberry Pi

First of all, what is Syncthing? As the official website says:

Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet.

In just a few words: it's an open source alternative to BTSync (formerly known as BittorrentSync)!
Since we like open source solutions, why don't we install it?

HOW TO INSTALL:

1) Let's check the latest release of syncthing on the official website:

https://github.com/syncthing/syncthing/releases


2) Now, connect via ssh to your Rapsberry Pi and download the latest armv5 version of syncthing:

For example:

wget https://github.com/syncthing/syncthing/releases/download/vx.yy.zz/syncthing-linux-armv5-vx.yy.zz.tar.gz

(IMPORTANT NOTE: x.yy.zz stands for the latest version number that you want to download, therefore if the latest version is, say, 0.10.23, the command will be:

wget https://github.com/syncthing/syncthing/releases/download/v0.10.23/syncthing-linux-armv5-v0.10.23.tar.gz


3) Untar it:

tar xvzf syncthing-linux-armv5-vx.yy.zz.tar.gz 

and rename the untarred folder:

mv syncthing-linux-armv5-vx.yy.zz syncthing


4) Now move to the syncthing directory:

cd syncthing

and start syncthing:

./syncthing

We are going to need to wait for the RSA key to be generated (have patience, it needs time!!):

pi@raspi ~/syncthing $ ./syncthing
13:07:22 INFO: Generating RSA certificate and key...
13:11:32 OK: Created RSA certificate file
13:11:32 OK: Created RSA key file
[FVCFD] 13:11:34 INFO: syncthing v0.10.22 (go1.2.2 linux-arm) jb@jborg-mbp 2015-02-26 15:48:25 UTC
[FVCFD] 13:11:34 INFO: My ID: HDUR8EHCIL3SJCHPA8UGMXIWKH8FHRTNCX6HBCOLOQ8FHSET7BV
[FVCFD] 13:11:34 INFO: No config file; starting with empty defaults
[FVCFD] 13:11:34 INFO: Edit /home/pi/.config/syncthing/config.xml to taste or use the GUI
[FVCFD] 13:11:34 INFO: Starting web GUI on http://127.0.0.1:8080/


5) Take note of the ID of your machine (in the example above it's the line that says: "[FVCFD] 13:11:34 INFO: My ID: HDUR8EHCIL3SJCHPA8UGMXIWKH8FHRTNCX6HBCOLOQ8FHSET7BV")


6) Since we are running a headless Raspberry Pi, we now need to enable the web GUI to be accessable from other machines:

nano /home/<user>/.config/syncthing/config.xml

To do this, just edit the line that says: <address>127.0.0.1:8080</address>
to: <address>0.0.0.0:8080</address>


7) Now we can connect to the Syncthing GUI from any computer in the network, just inserting the ip:port of the RasPi in any browser:

http://IP-of-RasPi:8080


8) Here we will be able to add other machines and the folders that need to be synced.

That's it!

Well, not entirely. If you want to make syncthing start at boot, just do as follows:

9) Let's create an init.d script for syncthing:

sudo nano /etc/init.d/syncthing

10) Copy the following lines and paste them inside it. Please don't forget to edit the two highlighted lines as per inline instructions)

===== BEGIN /etc/init.d/syncthing (do not copy this line) =====

#!/bin/sh
### BEGIN INIT INFO
# Provides: syncthing
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of syncthing.
# Description: Starts the syncthing daemon for all registered users.
### END INIT INFO

# Replace with users you want to run syncthing clients for
# syncthing_USERS="<your name here>"
syncthing_USERS="pi"  #Replace with your user
DAEMON=/home/user/syncthing/syncthing   #Replace with the path to syncthing

startd() {
  for stuser in $syncthing_USERS; do
    HOMEDIR=$(getent passwd $stuser | awk -F: '{print $6}')
    if [ -f $config ]; then
      echo "Starting syncthing for $stuser"
      start-stop-daemon -b -o -c $stuser -S -u $stuser -x $DAEMON
    else
      echo "Couldn't start syncthing for $stuser (no $config found)"
    fi
  done
}

stopd() {
  for stuser in $syncthing_USERS; do
    dbpid=$(pgrep -fu $stuser $DAEMON)
    if [ ! -z "$dbpid" ]; then
      echo "Stopping syncthing for $stuser"
      start-stop-daemon -o -c $stuser -K -u $stuser -x $DAEMON
    fi
  done
}

status() {
  for stuser in $syncthing_USERS; do
    dbpid=$(pgrep -fu $stuser $DAEMON)
    if [ -z "$dbpid" ]; then
      echo "syncthing for USER $stuser: not running."
    else
      echo "syncthing for USER $stuser: running (pid $dbpid)"
    fi
  done
}

case "$1" in
  start) startd
    ;;
  stop) stopd
    ;;
  restart|reload|force-reload) stopd && startd
    ;;
  status) status
    ;;
  *) echo "Usage: /etc/init.d/syncthing {start|stop|reload|force-reload|restart|status}"
     exit 1
   ;;
esac

exit 0

===== END /etc/init.d/syncthing (do not copy this line) =====

11) save and exit nano ('Ctrl-X' and then 'Y' to save)


12) Let's make the script executable:

sudo chmod +x /etc/init.d/syncthing


13) Let's update the init.d sequence:

sudo update-rc.d syncthing defaults


14) Let's start the daemon (just the first time, it will autostart from now on):

/etc/init.d/syncthing start

Now it's really done! :)



Credits: