2012年10月14日 星期日

[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

2012年9月27日 星期四

[RPi] Raspberry Pi ARM based bare metal examples

control low-level peripherals of Raspberry Pi directly without operating system, see this repo

2012年9月25日 星期二

[PHP] PHP UTF-8 cheatsheet

要確認PHP的輸出是否為UTF-8,有許多步驟要檢查,不過已經有人整理好了,順便筆記一下吧:

1. Update your database tables to use UTF-8
CREATE DATABASE db_name
 CHARACTER SET utf8
 DEFAULT CHARACTER SET utf8
 COLLATE utf8_general_ci
 DEFAULT COLLATE utf8_general_ci
 ;

ALTER DATABASE db_name
 CHARACTER SET utf8
 DEFAULT CHARACTER SET utf8
 COLLATE utf8_general_ci
 DEFAULT COLLATE utf8_general_ci
 ;

ALTER TABLE tbl_name
 DEFAULT CHARACTER SET utf8
 COLLATE utf8_general_ci
 ;

2. Install the mbstring extension for PHP

3. Configure mbstring
$ vim /path/to/php.ini
mbstring.language             = Neutral ; Set default language to Neutral(UTF-8) (default)
mbstring.internal_encoding    = UTF-8  ; Set default internal encoding to UTF-8
mbstring.encoding_translation = On  ;  HTTP input encoding translation is enabled
mbstring.http_input           = auto  ; Set HTTP input character set dectection to auto
mbstring.http_output          = UTF-8  ; Set HTTP output encoding to UTF-8
mbstring.detect_order         = auto  ; Set default character encoding detection order to auto
mbstring.substitute_character = none  ; Do not print invalid characters
default_charset               = UTF-8  ; Default character set for auto content type header

4. Deal with non-multibyte-safe functions in PHP
$ vim /path/to/php.ini
mbstring.func_overload = 7 ; All non-multibyte-safe functions are overloaded with the mbstring alternatives
change functions
mail()          -> mb_send_mail()
strlen()        -> mb_strlen() 
strpos()        -> mb_strpos()
strrpos()       -> mb_strrpos()
substr()        -> mb_substr()
strtolower()    -> mb_strtolower()
strtoupper()    -> mb_strtoupper()
substr_count()  -> mb_substr_count()
ereg()          -> mb_ereg()
eregi()         -> mb_eregi()
ereg_replace()  -> mb_ereg_replace()
eregi_replace() -> mb_eregi_replace() 
split()         -> mb_split()

5. Sort out HTML entities
add wrapper
/**
 * Encodes HTML safely for UTF-8. Use instead of htmlentities.
 *
 * @param string $var
 * @return string
 */
function html_encode($var)
{
 return htmlentities($var, ENT_QUOTES, 'UTF-8') ;
}

6. Check content-type headers
modify output
header('Content-type: text/html; charset=UTF-8') ;
and
<meta http-equiv="Content-type" value="text/html; charset=UTF-8" />

7. Update email scripts
use UTF-8 encoding in text file, and mb_encode_mimeheader() with content

8. Check binary files and strings


reference:
* PHP UTF-8 cheatsheet

2012年9月22日 星期六

[Tips] dpkg指令快速參考

Debian/Ubuntu系列相關都使用dpkg(Debian package management system)做為軟體管理系統,常用到的指令筆記一下
dpkg -i package.deb     # install
dpkg -r package         # remove
dpkg -P package         # purge, including configuration
dpkg -L package         # listfiles
dpkg -l package         # list package concisely
dpkg -S keyword         # find package(s) owning file(s)
dpkg -l                 # list installed package
dpkg -c package.deb     # listfiles                  

2012年9月16日 星期日

[Tips] Switch to External Monitor in LXDE

之前換了國人自製的LXDE,發現有些設定不太一樣,比如說想要將螢幕投到外接螢幕,function按鍵就沒作用,非要重開機才能正常,爬了一下才發現原來LXDE還有做這樣的螢幕管理工具,說明如下:
Description: simple monitor config tool for LXDE This is a very basic monitor config tool utilizing the X extension called RandR. It can let you change the screen resolution on the fly. Besides, when you run lxrandr with external monitor connected, its GUI will change, and show you some quick options to get your projector or external monitor working correctly.

執行方式就是直接呼叫
$ sudo lxrandr

預設執行起來應該是這樣

如果有外接螢幕就會變成這樣

選擇正確的輸出就可以快樂的投影了