2012年12月9日 星期日

[RPi] Setting up Wifi with Raspberry Pi

要購買Raspberry Pi的週邊最好是參考這裡,才不會踩到地雷,買到不支援的東西,話說我是買ASUS USB-N10當作無線網路卡,畢竟總是要支持一下國貨

在Raspbian的環境設定無線網路的方法一個是透過GUI,也就是桌面上的WiFi Config,啟動後選擇Adapter為wlan0,然後點選下面的scan,搜尋完畢後點選適合的WiFi,選擇適合的加密方式與輸入正確的金鑰,最後connect就可以快樂的連上網路了

不然就是要透過command,流程大概是這樣
1.更新套件
$ sudo apt-get update && sudo apt-get upgrade

2.檢查USB是否有偵測到新的裝置(用的是RTK RTL8188SU的晶片)
$ lsusb
...
Bus 001 Device 004: ID 0b05:1786 ASUSTek Computer, Inc. USB-N10 802.11n Network Adapter [Realtek RTL8188SU]
...

3.檢查是否有載入無線網路模組
$ lsmod
Module                  Size  Used by
...
r8712u                165407  0 
...

4.安裝wireless工具
$ sudo apt-get install wireless-tools

5.根據加密方式做適合的設定 如果是WEP加密
$ sudo vi /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid <ssid>
wireless-key s:<password>

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off
iface default inet dhcp

如果是WPA加密
$ sudo vi /etc/network/interfaces
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid <ssid>
wpa-psk s:<password>

另外一種方法是安裝WPA的設定工具(在有線網路的情況下)
$ sudo apt-get install wpasupplicant

然後就可以透過不同的設定檔管理不同的加密WiFi(要加雙引號)
$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="YOUR SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="YOUR PASSWORD"
}

指定無線網卡讀取適當的設定檔
$ sudo vi /etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

最後,有幾個指令常常用到:
看無線網卡讀到的無線網路資訊,可以確認無線網卡是否有作用
$ iwlist wlan0 scan
重新向DHCP Server要IP
$ dhclient wlan0

 reference:
* WiFi on Rasspberry Pi with ASUS USB N10
* Setting up Wifi under Debian on Raspberry Pi

2012年11月30日 星期五

[RPi] 在e絡盟購買Raspberry Pi

e絡盟的Raspberry Pi購買網頁今天做了些更動,以後個人用戶將只能透過代理商購買,企業用戶將不在此限制範圍,看來未來台灣地區的個人買家將被一統江湖了

2012年10月22日 星期一

[RPi] Firmware of Raspberry Pi 512MB

最近拿到Rev2的板子,是512MB的,可是讀出來的資訊不太正確,而且還是只能用256MB的RAM
但根據文件的說明,Revision應該要顯示13/14/15,可是現在讀出的是0005

板子上原來裝的是2012-09-18-wheezy-raspbian版本的image,在討論串說更新到最新版本的firmware就能讀到正確的硬體資訊,更新firmware的步驟如下:
0.安裝git-core
$ sudo apt-get install git-core

1.更新套件
$ sudo apt-get update; sudo apt-get upgrade

2.下載rpi-update的script並複製到/usr/bin
$ sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update

3.更改權限為可執行
$ sudo chmod +x /usr/bin/rpi-update

4.執行rpi-update
$ sudo rpi-update

5.執行完畢後將在root底下產生一堆檔案
$ sudo ls -la /root/.rpi-firmware

以下步驟要用root權限執行
6.切到boot目錄
$ cd /boot

7.刪除一堆檔案(最新版本的firmware已經不需要這步驟)
$ sudo rm arm*.elf $ sudo rm loader.bin

8.將更新完的binary和data複製到/boot
$ sudo cp /root/.rpi-firmware/start.elf . $ sudo cp /root/.rpi-firmware/fixup*.dat .

9.新增一行gpu使用的memory,例如64
$ sudo vim config.txt
gpu_mem=64

10.重新開機就可以了
$ sudo reboot

可以看到Revision變成000f(16進位的15),而記憶體也變成438MB了,因為有部份拿去給GPU使用了


reference:
* Raspberry Pi Model B Revision 2.0 (512MB) Changes
* Test Whether Raspberry Pi Has 512MB RAM

2012年10月14日 星期日

[阿宅專區] SanDisk SDHC SD記憶卡

最近在玩Raspberry Pi所以需要購買SD卡測試不同的image,因為平常在光華商場買習慣了,也沒有特別上網比價,今天一比才發現我的頭真是太大了!!! 以下都是SanDisk的:

* 16GB Ultra 30MB/s Class 10: 我買360元, 網路價279元
* 16GB Extreme 45MB/s Class 10: 我買580元, 網路價465元
* 16GB Extreme Pro 95MB/s Class 10: 問到16xx元, 網路價1183元

[RPi] Raspberry Pi Rev2 is selling NOW

RPi的rev2要開賣了,大部分的修改細節之前都有公告過了,不過最令人驚訝的是竟然記憶體升級到512MB了,可以從e絡盟網站證實


修改的部份如下:
Reset
A reset circuit has been implemented, although in the standard build the required header is not fitted. Users wishing to use this circuit should fit an appropriate header to P6. Shorting P6 pin 1 to P6 pin 2 will cause the BCM2835 to reset.

USB Output Power
The resetable fuses protecting the USB outputs have been removed. This feature was implemented on some later revision 1.0 PCBs by replacing the fuses with links; revision 2.0 permanently implements this modification. It is now possible to reliably power the RPI from a USB hub that back feeds power, but it is important that the chosen hub cannot supply more than 2.5A under fault conditions.

JTAG Debug Support
Two GPIO pins have been interchanged to allow a missing debug signal (ARM_TMS) to appear on P1 pin 13.
Originally the connections were:
- CAM_GPIO [BCM2835/GPIO27] routed to S5 pin 11
- GPIO_GEN2 [BCM2835/GPIO21] routed to P1 pin 13
The new connections are:
- CAM_GPIO [BCM2835/GPIO21] routed to S5 pin 11
- GPIO_GEN2 [BCM2835/GPIO27] routed to P1 pin 13

I2C Support on P1/P6
The primary and secondary I2C channels have been reversed.
Originally the connections were:
- SCL0 [BCM2835/GPIO1] routed to P1 pin 5
- SDA0 [BCM2835/GPIO0] routed to P1 pin 3
- SCL1 [BCM2835/GPIO3] routed to S5 pin 13
- SDA1 [BCM2835/GPIO2] routed to S5 pin 14
The new connections are
- SCL0 [BCM2835/GPIO1] routed to S5 pin 13
- SDA0 [BCM2835/GPIO0] routed to S5 pin 14
- SCL1 [BCM2835/GPIO3] routed to P1 pin 5
- SDA1 [BCM2835/GPIO2] routed to P1 pin 3

Version Identification Links
The four GPIO signals originally used for version identification have been removed. These were never read by the system software and were redundant.

Additional I/O Expansion
To utilise GPIO signals released by the removal of the version identification links, a new connector site P5 has been added. This carries the four GPIO signals [BCM2835/GPIO28 – BCM2835/GPIO31] named GPIO7 – GPIO10 respectively, along with +5V0, +3V3 and two 0V. Currently this connector is not populated.
This GPIO allocation provides access to one of:
- SDA0, SCL0 (Operating independently of P1 SDA1, SCL1); or
- PCM_CLK, PCM_FS, PCM_DIN, PCM_DOUT or I2S; or
- Four GPIO signals.
This connector is intended to be a suitable attachment point for third-party clock and audio codec boards, and is pinned to be mounted (ideally) on the underside due to connector clash. Pin 1 is marked with the square pad (top left – looking from the top).

+5V0 Leakage from HDMI
Some users have found that connecting an unpowered Raspberry Pi to an HDMI television interferes with the correct operation of CEC for other connected devices. This was fixed on some later revision 1.0 PCBs by removing the ESD protection diode D14; revision 2.0 fixes this issue by connecting the top side of the diode to +5V0_HDMI.

SMSC +1V8
The SMSC 1V8 power has been disconnected from the system supply.

Mounting Holes!
Two 2.5mm (drilled 2.9mm for M2.5 screw) non plated mounting holes have been provided to assist with ATE test mounting. Positions of these holes relative to the bottom left of the PCB (Power Input Corner) are:
- Corner: 0.0mm,0.0mm
- First Mount: 25.5mm,18.0mm
- Second Mount: 80.1mm, 43.6mm
Warning: If used to permanently mount the PCB – do not over tighten screws or drill out to fit larger screws, as this will lead to damage to the PCB.

LED Marking
Two minor changes have been made to the silk screen: - D9 (Yellow LED) graphic changed from the incorrect 10M to 100 - D5 (Green LED) graphic changed from OK to ACT (Activity)


/** update @ 2012-10-16 **/
看到拍賣網站有人在預購

2012年10月7日 星期日

[RPi] X11 Forwarding Over SSH2

拿到Raspberry Pi除了從console登入後開啟X Window也可透過SSH將X遠端傳送過來

environment:
* PC : Ubuntu 10.04
* RPi: 2012-09-18-wheezy-raspbian.img

1.將Ubuntu的X Server權限打開
可以透過command的方式將allowed_users修改為anybody
$ sudo vim /etc/X11/Xwrapper.config
或是dpkg,選擇Anybody即可
$ sudo dpkg-reconfigure x11-common
Because the X server runs with superuser privileges, it may be unwise to permit any user to start it, for security  reasons.  On the other hand, it is even more unwise to run general-purpose X client programs as root, which is what may happen if only root is permitted to start the X server.  A good compromise is to permit the X server to be started only by users logged in to one of the virtual consoles.
Users allowed to start the X server:  
           Root Only    
       Console Users Only      
            Anybody     

2.在Ubuntu下指令,就可以X11 Forwarding Over SSH2了
$ xinit -e ssh -XY user@pi lxsession -- :1

順便紀錄一下幾個指令與文章:
查看目前所使用的window manager(Debian/Ubuntu系列需安裝wmctrl)
$ wmctrl -m
Name: Openbox
Class: 
PID: N/A
Window manager's "showing the desktop" mode: OFF
查看目前所使用的Desktop Environment
$ echo $XDG_CURRENT_DESKTOP
LXDE

這篇講到的tty和:N的確容易搞混,裡面是這樣說的
You may be confusing virtual console numbers, ttyN, with X display numbers, :N. ttyN, where N is typically 1..12, is the console that you see after you press Ctrl+Alt+FN, and tty0 is a special device referring to the current console. :N, where N is typically 0..9, refers to the Nth different X server on the host, usually counting from zero.
這篇對整個X,SSH,Window Managers和Desktop Environments有詳細的說明,並解釋了各種X over SSH的方式與比較其優缺點

reference:
* X Over SSH2 - A Tutorial
* [Howto] Redirect X over SSH to other PC
* 理解 Xwindow

2012年10月1日 星期一

[Tips] 更新字體的cache

今天想說裝個很潮的Gill Sans和LiHei Pro字體,找到ttf也顯示installed,但是在文字選擇卻找不到,後來重新更新cache就解決了
$ sudo fc-cache -fv


reference: Installed entire font family, but only one appears