Get started with Cubian - cubieplayer/Cubian GitHub Wiki

LED indicators


Cubian uses the two onboard LED (Blue and Green) as the indicator of some events.

  • The green LED indicate system status. If this LED blinking every 1 second, it means the system is starting up or shutting down normally, after the system has started this LED turns to indicates the SD-card r/w status.

  • The blue LED indicate the network status. if this LED starts to blink every 1 second, it means the system did NOT connected to a network, after the system has connected to network successfully, this LED will turn OFF.

Morse Code IP


This is the fun part of Cubian. Morse code is an old communication technology. It is so simple that makes it still very useful in some scenarios today. Consider the following scenarios

  1. You have a monitor with DVI,VGA dual input but w/o HDMI
  2. You forgot to buy a USB-TTL cable
  3. You don't have the admin privilege to the router, even you know the cubieboard connected to the network, but you don't know the IP address.

If you still want to play your cubieboard you need to know the IP address.Here comes the solution. Cubian will use Morse code to echo the IP address to you once it owns one.

Once the network connected, after 30 seconds (waiting for dhcp response). The green LED will turned ON for 3 seconds, it reminds you need to focus your mind, and prepare to write down the morse code. After the green LED turned OFF. The blue LED starts to show the morse code to you.

Note,You just want to know the last 3 digits of IP address under most circumstances, so the echo sequence is reversed. For example, if the IP address is 192.168.1.100 the echo sequence will be 001.1.861.291. the Morse code will be

----- ----- O---- O-O-O- O---- O-O-O- ---OO -OOOO O---- O-O-O- OO--- ----O O----

It will take about 74 seconds to complete the process. Their is 2 seconds resting time after each symbol.

The map from blue LED lighting time to morse code

Lighting Time Means
0.5 sec O
1 sec -

Part of International Morse Code Table

Symbol Morse
0 - - - - -
1 O - - - -
2 O O - - -
3 O O O - -
4 O O O O -
5 O O O O O
6 - O O O O
7 - - O O O
8 - - - O O
9 - - - - O
. O - O - O -

It's less fun but if you are in a hurry or don't know your morse very well you should be able to spot the ip address with:

arp -a

SSH


The SSH Server port has changed to 36000 (default 22) to prevent somebody using the scanner scan and hack your system. For the same security reason, root user is NOT allowed to login via SSH. But you can use sudo -i command to change to root after you logged in as a normal user via SSH.

The default username is cubie, password is the same as username, once your logged in, you can do anything with sudo, and don't need to type the password again.

ssh -p 36000 YOUR_CUBIEBOARD_IP -l cubie

Enable root


The root user is NOT enabled by default. You can enable it by the following command

cubie@Cubian:~# sudo passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Connect to network


First of all, Do not use low level configuration tools such as ifconfig and ip commands to configure an interface in up state.
For more details about network configuration, take a look at the official Debian reference manual

  1. Wired
    There is already a default configuration for you.

     cubie@Cubian:~# sudo cat /etc/network/interfaces 
     auto eth0
     allow-hotplug eth0
     iface eth0 inet dhcp
    

    Explanations:
    auto eth0 means auto config interface eth0 on start up
    allow-hotplug eth0 and iface eth0 inet dhcp means when the Linux kernel detects the physical interface eth0, the allow-hotplug stanza causes ifup to bring up the interface and the iface stanza causes ifup to use DHCP to configure the interface.
    Note:This configuration will bring up your RJ45 network interface on startup, and try to config it through dhcp service. If you don't plugin network cable, it will block the startup for 1 minute waiting for DHCP timeout then continue to boot up.
    If you absolutely don't need the wired network,plase disable this feature by comment or delete auto eth0 at /etc/network/interfaces, It will save a lot of time for you on system start up. To comment it, just add a # before the line auto eth0,It will looks like #auto eth0
    You can still bring up and config the wired interface manually, just do

     cubie@Cubian:~# ifup eth0
    

    If you want to use static IP configuration, There is a sample below

     allow-hotplug eth0
     iface eth0 inet static
         address 192.168.11.100
         netmask 255.255.255.0
         gateway 192.168.11.1
         dns-domain example.com
         dns-nameservers 192.168.11.1
    

    It should be familiar with you.

  2. Wireless

    1. Check that there is wlan0 interface in iwconfig's output. If there isn't, modprobe the necessary module (e.g. "modprobe bcmdhd" for cubietruck).

    2. Scanning for AP. below is a script adopted from this article

      IFACE=$1
      
      ip link set $IFACE up
      
      SCAN=$( 
      iwlist $IFACE scan 2>&1 | grep -v "^$IFACE" | grep -v "^$" | 
          sed -e "s/^ *//" 
              -e "s/^Cell [0-9]+ - /#/" 
              -e "s/^#Address: /#AP=/" 
              -e "s/^Quality:([0-9]+)/.*$/QUALITY=1/" 
              -e "s/^.*Channel ([0-9]+).*$/CHANNEL=1/" 
              -e "s/^ESSID:/ESSID=/" 
              -e "s/^Mode:/MODE=/" 
              -e "s/^Encryption key:/ENC=/" 
              -e "s/^[^#].*:.*//" | 
          tr "n#" "|n" 
      )
      
      for i in $SCAN ; do
          AP=""; QUALITY=""; CHANNEL=""; ESSID=""; MODE=""; ENC=""
          isGarbageLine=true
          for j in $(echo $i | sed -e "s/|/ /g" ) ; do
              case $j in
                  AP=*)
                      AP=${j#AP=}
          		isGarbageLine=false
                      ;;
                  QUALITY=*)
                      QUALITY=${j#QUALITY=}
          		isGarbageLine=false
                      ;;
                  CHANNEL=*)
                      CHANNEL=${j#CHANNEL=}
          		isGarbageLine=false
                      ;;
                  ESSID=*)
                      ESSID=${j#ESSID=}
          		isGarbageLine=false
                      ;;
                  MODE=*)
                      MODE=${j#MODE=}
          		isGarbageLine=false
                      ;;
                  ENC=*)
                      ENC=${j#ENC=}
          		isGarbageLine=false
                      ;;
              esac
          done
          if [ $isGarbageLine = false ];then
              echo "$AP $QUALITY $CHANNEL $ESSID $MODE $ENC"
          fi
      done
      
    3. Open (No Password)

      Modify the network configuration file

       cubie@Cubian:~# sudo cat>>/etc/network/interfaces<<EOF
       >allow-hotplug wlan0
       >iface wlan0 inet dhcp
       >    wireless-essid mynetwork
       >    wireless-mode managed
       >EOF
      

      Then, connect to network by execute

       cubie@Cubian:~# ifup wlan0
      

      If you want to connect network on system start up, just add

       auto wlan0
      
    4. WEP
      Warning: WEP encryption has been proven insecure and can be cracked in a few minutes using free utilities that can be downloaded from the Internet.Never use it if your network is sensitive. Modify the network configuration file

       cubie@Cubian:~# sudo cat>>/etc/network/interfaces<<EOF
       >allow-hotplug wlan0
       >iface wlan0 inet dhcp
       >    wireless-essid mynetwork
       >    wireless-key1 1234567890
       >EOF
      

      Then, connect to network by execute

       cubie@Cubian:~# ifup wlan0
      

      If you want to connect network on system start up, just add

       auto wlan0
      
    5. WPA/WPA2
      First, you need to generate PSK (Pre Shared Key).

       cubie@Cubian:~# wpa_passphrase "mynetwork" "1234567890" | grep psk=[a-f,0-9]
           psk=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
      

      Then, modify /etc/network/interfaces add network configuration

       cubie@Cubian:~# sudo cat>>/etc/network/interfaces<<EOF
       >allow-hotplug wlan0
       >iface wlan0 inet dhcp
       >    wpa-ssid mynetwork
       >    wpa-psk 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
       >EOF
      

      Then, connect to network by execute

       cubie@Cubian:~# ifup wlan0
      

      If you want to connect network on system start up, just add

       auto wlan0
      

Config DateTime


The datetime will be configured automatically through ntp service on each time the system starting up and connected to internet.
You can sync the datetime from internet ntp server manually.

cubie@Cubian:~# sudo ntpdate-debian
29 May 19:52:44 ntpdate[6746]: adjust time server 212.26.18.41 offset 0.008102 sec

Cubian update


It's a good idea to keep the kernel and drivers, firmwares to the latest version.

sudo apt-get install cubian-update
sudo cubian-update