2013-04-21 Raspberry Pi

/pics/8668963053_8315a1de94_n.jpg

I got a Raspberry Pi from my employer. Nice! Installed Raspbian. Used HDMI to connect to the TV. That worked.

Raspberry Pi

Raspbian

Note: I have a 2Gb and a 4Gb card and I want to give PiMAME a try (play arcade games using MAME), so I will need the 4Gb card for PiMAME. At the same time, I want to use Raspbian to play videos. That goes on the 2Gb card.

PiMAME

MAME

Raspbian

Connected Apple keyboard and mouse via USB. That caused repeating keys and all that. I read that the problem is a lack of power on the USB port. I could buy a USB hub as suggested.

lack of power on the USB port

as suggested

One cable to rule them all. The cable modem is too far from the TV. Even if I did that, it would take my wireless network down. On my Mac Mini, I enabled sharing of my wireless connection with the ethernet (System Preferences → Sharing → Internet Sharing) and connected the Raspberry Pi to my Mac using an ordinary ethernet cable I had lying around. I was able to connect using `ssh pi@192.168.2.3`. You might have to guess the last digit?

Via ssh, I run **sudo raspi-config** and set it up: `expand_rootfs`, `configure_keyboard`, `change_locale` (choose de_CH.UTF8, pick en_GB.UTF8 as the default), `set_timezone` (Europe / Zurich), `memory_split` (64)… Maybe the memory split is already the default? I might have to switch on overclocking in the future in order to play games.

Following suggestions online, I wanted to get my Apple bluetooth keyboard working. First, I updated and upgraded my packages before doing anything: *sudo apt-get update*, *sudo apt-get upgrade* and *sudo apt-get autoremove*.

suggestions online

Note: Do all this while connected to the Raspberry Pi via ssh. You keyboard needs to be paired and all that before it will work stand-alone.

Next, bluetooth: *sudo apt-get install bluetooth bluez-utils blueman*. This installs a lot of stuff I probably won’t need. Oh well, I spent some time trying to sort through it and figured it wasn’t worth it. If you’re installing on a 2Gi card, you’re going to be running out of space real soon now:

pi@raspberrypi ~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
rootfs           1838936 1751248         0 100% /

Try **sudo apt-get clean** to make some space:

pi@raspberrypi ~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
rootfs           1838936 1567016    178880  90% /

In the end, this is how it should work:

pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0a5c:200a Broadcom Corp. BCM2035 Bluetooth dongle

I guess the Bluetooth dongle has been recognized!

pi@raspberrypi ~ $ hcitool scan
Scanning ...
	E8:06:88:38:C6:2F	Apple Wireless Keyboard
	00:02:72:D4:E9:EA	DOC-PC

This was a bit more complicated:

pi@raspberrypi ~ $ sudo bluez-simple-agent hci0 E8:06:88:38:C6:2F
RequestPinCode (/org/bluez/5802/hci0/dev_E8_06_88_38_C6_2F)
Enter PIN Code: 0000
Release
New device (/org/bluez/5802/hci0/dev_E8_06_88_38_C6_2F)

Type `0000 RET` on the Mac. Type `0000 RET` on the keyboard. Not sure whether the “sudo” was required or not.

On we go:

pi@raspberrypi ~ $ sudo bluez-test-device trusted E8:06:88:38:C6:2F yes

Make sure the keyboard is “on” when you run the next step:

pi@raspberrypi ~ $ sudo bluez-test-input connect E8:06:88:38:C6:2F

Ok, time to give it a try… Remember that you’re *probably* using a British keyboard layout. The y key might be where your z is. This is important because the default password is *raspberry* ← note the y. Switch your keyboard layout: **sudo dpkg-reconfigure keyboard-configuration** has no effect? Try **sudo vi _etc_defaults/keyboard**:

XKBMODEL="apple"
XKBLAYOUT="ch"
XBKVARIANT=""
XKBOPTIONS="lv3:ralt_switch"
BACKSPACE="guess"

Unfortunately the option key still doesn’t work for simple things like `[]|{}`. Sucks to be me!

For my Sony Bravia, I had to use the following in **sudo vi _boot_config.txt**:

disable_overscan=1
overscan_left=53
overscan_right=50
overscan_top=28
overscan_bottom=22

Don’t ask me why overscan is both disabled and its various parameters are set.

Copied various videos on to a USB Stick. Create a mountpoint using **sudo mkdir _mnt_BIG_STICK** and mount the drive using **sudo mount -o uid=pi,gid=pi _dev_sda1 _mnt_BIG_STICK**.

Play it using **omxplayer _mnt_BIG_STICK/some_file.mp4** → it worked! 🙂 👌

In order to avoid typing this every time, use **ls -laF _dev_disk/by-uuid** and note the uuid of the mounted stick. Then **sudo vi _etc_fstab** and start typing:

UUID=8805-CE39 /media/Cruzer8Gb vfat auto,users,rw,flush,utf8=1,uid=pi,gid=pi,dmask=002,fmask=113 0 0

But there was *no sound*! Well, there’s sound on the headphones out of the Raspberry Pi but no sound on the TV. I tried both HDMI inputs. I uncommented `hdmi_drive=2` in the `/boot/config.txt` file. To no avail. When I tried **aplay _usr_share/sounds/alsa/Front_Center.wav**, however, it worked. Something about the .avi file, or about omxplayer isn’t working. Checking `omxplayer --help` I found the solution: **omxplayer -o hdmi _media_Cruzer8Gb/some_file.mp4** → it worked! 🙂 👌

A day later...

I wanted to `sudo apt-get install libnss-mdns` and install `bonjour` so that I can connect to it via `raspberry.local` instead of `192.168.2.3`: **sudo apt-get install libnss-mdns**—but apparently it’s already installed!

alex@Pyrobombus ~$ ssh pi@raspberrypi.local
The authenticity of host 'raspberrypi.local (192.168.2.3)' can't be established.
RSA key fingerprint is 4e:e2:82:e5:e9:e5:5f:a9:b6:ac:53:f0:e2:3b:ac:c1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi.local' (RSA) to the list of known hosts.
pi@raspberrypi.local's password:
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Apr 22 10:56:12 2013 from pyrobombus.local
pi@raspberrypi ~ $

Yay!

If you’re not using a Mac, you’ll need to install bonjour on your host system as well, I think.

Next I wanted to play a game using my Xbox USB controller (not necessarily the wireless variant). **sudo apt-get install xboxdrv**. Simply running `sudo xboxdrv` gave me gave me a lot of output. The driver must be working. 👌 The driver has a man page.

play a game using my Xbox USB controller

has a man page

​#Raspberry Pi