「ソフトウェア」カテゴリーアーカイブ

Raspberry Pi Imager

これまで Raspberry Pi の SD カードにOSをインストールするには、Win32 Disk Imager 等を利用していましたが、Raspberry Pi 向けの Raspberry Pi Imager がリリースされました。

Raspberry Pi Imagerを使用すると、Raspberry Pi OSおよびその他のOSをSDカードに簡単にインストールすることができます。

Screenshot of www.raspberrypi.org

 

 

Raspberry Pi Imager を起動したところ。PC に接続した SD カードリーダーに microSDHC カードを挿入した後、「CHOOSE SD CARD」ボタンを押して挿入した SD カードを選択します。

「CHOOSE OS」ボタンを押して、インストールしたい OS を選択します。

 

「WRITE」ボタンを押して SD カードに書き込みます。 SD カードの中身は上書きされるので注意しましょう。

その他、Operation System の選択時に「Erase」を選択して書き込みを行うと、SD カードを FAT32 でフォーマットすることもできます。

また、「Use Custom」を選択すると、Win32 Disk Imager  と同じのように任意の .img ファイルを SD カードに書き込むことが可能です。ただし、SD カードの内容を読みだして .img ファイルを作る機能はないようです。

 

microSDカード 32GB UHS-I U3 V30, Class 10, 書込最大60MB/s, A1, SD 変換アダプタ付属

 

microSDカード 32GB UHS-I Class10 読取り最大98MB/s, A1, SD 変換アダプタ付属

 

USB3.0カードリーダー

 

USB3.1 Gen2, microSD x 2 高速カードリーダー

 

Raspberry Pi をスマートリモコン化 -その3-

赤外線学習リモコンボード RPi-IREX を使った Raspberry Pi のスマートリモコン化の第3弾です。

今回は、これまで紹介しきれなかった以下の内容について紹介します。

  • Homebridge の自動起動化
  • シーンの設定
  • 外出先からのコントロール
  • オートメーション

続きを読む Raspberry Pi をスマートリモコン化 -その3-

Raspberry Pi をスマートリモコン化 -その2-

Raspberry Pi をスマートリモコン化 -その1-」では、赤外線学習リモコンボード RPi-IREX の設定方法を紹介しましたが、今回はその続きで iPhone の Siri を使った音声入力によって  RPi-IREX をコントロールし、テレビや照明を操作できるようになるまでの設定方法を紹介します。

まず、iPhone の Siri を使うことで音声で HomeKit 対応アクセサリをコントロールすることができます。RPi-IREX 自体は HomeKit に直接対応していないのですが、RaspberryPi で Homebridge を動かすことで HomeKit に対応することができ、Siri から RPi-IREX をコントロールして、テレビや照明をつけたり、消したりすることができるようになるわけです。

では、Homebridge の設定を始めましょう。

続きを読む Raspberry Pi をスマートリモコン化 -その2-

Raspberry Pi の lscpu

lscpu コマンド

lscpu コマンドで CPU 情報を表示することができます。

Raspberry Pi での lscpu コマンドの実行結果を以下に示します。

 

Raspberry Pi2 model B+

 

Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
Model name:            ARMv7 Processor rev 5 (v7l)
CPU max MHz:           900.0000
CPU min MHz:           600.0000

 

Raspberry Pi model B+

 

Architecture:          armv6l
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1

 

Raspberry Pi のファームウェアのアップデート

Raspberry Pi の最新ファームウェアは、Raspbian から rpi-update コマンドでアップデートすることができます。

ただし、最新版にアップデートしたい場合のみ使用してください。rpi-update を使わなくても通常の Raspbian のパッケージ更新で安定版にアップデートできます。

公式には rpi-update で最新のファームウェアのアップデートは推奨されていません。最新版が必ずしも良いというわけではないのでご注意ください。(安定版じゃないから)

続きを読む Raspberry Pi のファームウェアのアップデート

Raspberry Pi のインストール済みパッケージ一覧

Raspberry Pi の標準的な OS である Raspbian は Debian がベースになっています。

なので、Debian 同様に Raspberry Pi (Raspbian) にインストール済みのパッケージの一覧は dpkg コマンドで調べることができます。

$ dpkg -l

 

複数の Raspberry Pi を管理していて、全ての Raspberry Pi にインストールしているパッケージを揃えたいといった場合には役立つことでしょう。

あるは、OS のクリーンインストールを行う前にリストを作成しておいて、クリーンインストール後にリストにあるパッケージをインストールすることで前の環境に近づけるのにも使えます。

私は Wheezy から Jessie にバージョンアップする際にクリーンインストールを行ったので、Wheezy 環境でインストールしたパッケージのリストを取っておいて、Jessie 環境にリストのパッケージをインストールし直しました。もちろん、ユーザファイルや設定ファイル等は別にバックアップが必要ですのでその点はご注意ください。

 

 

Raspberry Pi2 の X11 で OpenGL のハードウェアアクセラレート – その2 –

glxgears
glxgears

Raspberry Pi2 では、Desktop GL driver を有効化することで、X11 上で OpenGL アプリケーションのハードウェアアクセラレートが可能となります。

Raspberry Pi2 の X11 で OpenGL のハードウェアアクセラレート – その1-」では、Desktop GL driver の有効化方法を紹介しました。

今回は、ソフトウェアレンダラーとの比較と Desktop GL driver の問題点を紹介します。

続きを読む Raspberry Pi2 の X11 で OpenGL のハードウェアアクセラレート – その2 –

Raspberry Pi2 の X11 で OpenGL のハードウェアアクセラレート – その1-

glxgears
glxgears

これまで Raspbian の X11 では OpenGL は使用できませんでした(X サーバは GLX に対応していました)が、Jessie の最新ではハードウェア対応の OpenGL 2.1 が動くようになりました。

Raspberry Pi2 の GPU はモバイル用なので、OpenGL ES 1.1, OpenGL ES 2.0 対応の GPU です。しかし、OpenGL 2.1 はデスクトップ向けのものであり、ネイティブでは対応していません。そのため OpenGL 2.1 は内部的に OpenGL ES 2.0 に変換して対応しているものと考えられます。

続きを読む Raspberry Pi2 の X11 で OpenGL のハードウェアアクセラレート – その1-

Raspberry Pi の Debian ディストリビューションのバージョン

Raspberry Pi の標準 OS である Raspbian は Debian を元に作られています。その元になっている Debian のディストリビューションのバージョンは /etc/debian_versionというファイルに書かれています。

Jessie の場合:

$ cat /etc/debian_version
8.0

 

Wheezy の場合:

$ cat /etc/debian_version
7.8

 

lsb_release コマンドに -a オプションを付けて実行するとより詳しい情報が表示されます。

インストール方法:

$ sudo apt-get install lsb-release

 

Jessie の場合:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:    8.0
Codename:   jessie

 

Wheezy の場合:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.8 (wheezy)
Release:    7.8
Codename:   wheezy

wheezy_001

 

Raspberry Pi で rdesktop

rdesktop

rdesktop は、リモートデスクトップクライアントソフトウェアです。Raspberry Pi から Windows にリモートデスクトップ接続することができます。(リモートデスクトップ接続可能な Windows に限ります。)

rdesktop
rdesktop

この例では、Windows Server 2012 の Hyper-V の仮想マシンで動かしている Windows 8.1 Enterprise に Raspberry Pi から接続したものです。(RemoteFX 環境)

インストール方法:

apt-get で rdesktop をインストールします。

$ sudo apt-get install rdesktop

 

使用方法:

$ rdesktop [options] server

 

主なオプション:

以下に主なオプションを示します。その他のオプションはオンラインマニュアルをご覧ください。

-u <USER>

ユーザ名の指定

-d <DOMAIN>

ドメインの指定

-p <PASSWD>

パスワードの指定

-g <GEOMETORY>

デスクトップサイズの指定。<width>x<height> または “xx%” で指定

-f

デスクトップサイズをフルスクリーンで指定

 

備考:

rdesktop がサポートする RDP のバージョンは、RDP 5 (デフォルト) と RDP 4 です。(ですが、クライアント側だからか、RemoteFX の GPU アクセラレーションは有効になっているようです。)

rdesktop - RemoteFX -

Raspberry Pi で atlantis

atlantis を Raspberry Pi に移植しました。

atlantis は、OpenGL の初期の頃のデモアプリケーションで、母クジラ、子クジラ、イルカ、サメ4匹が泳ぎまわります。

atlantis
atlantis

オリジナルのソースコードは、以下からダウンロードできます。(GLUT のソースにも含まれます。)

https://www.opengl.org/archives/resources/code/samples/glut_examples/demos/demos.html

ソースのコピーライトを見ると 1993, 1994 となっているので、もう 20 年以上前ですね。

Windows 用の実行ファイルも含まれていますが、Cosmo 3D (SGI の Windows 用 OpenGL) の DLL が必要なので、動かせる環境はもうないでしょうね。そのため、Windows でも自前でビルドする必要がありそうです。

また、X のスクリーンセーバの xscreensaver-gl-extra にも改良版の atlantis が含まれています。たぶん、O2 が発売された頃にプロジェクションマッピングに対応したものがベースとなっていると思います。

オリジナルは GLUT + OpenGL ですが、Raspberry Pi で動かすために、SDL2 + OpenGL ES 1.1 に書き換えました。Raspberry Pi2 なら、そこそこ動きます。

よく見るとクジラのポリゴンが裏返っているようです。

ということで、クジラのポリゴンをキー入力で裏返す機能も付けました。

以下は、クジラのポリゴンを裏返して正しい表示にしたものです。

atlantis002
atlantis002
atlantis003
atlantis003
atlantis004
atlantis004
atlantis005
atlantis005

 

Raspberry Pi で TightVNC サーバ

TightVNC サーバ

Raspberry Pi 本体のデスクトップ(Xサーバ)とは別にクライアント用のデスクトップ(Xサーバ)を使用することができる VNC サーバです。

Raspberry Pi 本体のデスクトップ(Xサーバ)は通常ディスプレイ番号0番で、HDMI 等で接続したディスプレイに表示されるデスクトップを指します。

TightVNC の VNC サーバは、それとは別のデスクトップ(ディスプレイ番号が異なる)でリモートで表示/操作することができます。VNCサーバを複数起動することで、異なるデスクトップを複数作成することができます。(それらはそれぞれディスプレイ番号が異なります。)また、それぞれのデスクトップのユーザは異なっても構いません。

※ 実は TightVNC には x0vncserver という本体のデスクトップをリモート操作するための VNC サーバもありますが、Raspberry Pi には apt-get でインストールすることはできません。(Raspberry Pi 用の x0vncserver をソースからビルドできるかどうかは不明です)

インストール方法:

apt-get で tightvncserver をインストールします。(必須ではありませんが、tightvncserver で使用する X11/75dpi, 100dpi フォントもインストールします。)

$ sudo apt-get install tightvncserver xfonts-75dpi xfonts-100dpi

 

使用方法:

VNC のパスワードはユーザごとに管理されており、vncserver 初回起動時にそのユーザのパスワード設定を行います。(パスワードは後から vncpasswd で変更することも可能です。)
パスワードは6文字以上8文字以下。
$ vncserver

You will require a password to access your desktops.

Password:********
Verify:********
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is raspberrypi:1

パスワードの設定が行われた後、(vncserver を起動したユーザで)新しい X サーバが起動します。

‘raspberrypi:1′ の部分は、’VNC サーバのホスト名:ディスプレイ番号’ のことであり、また、5900 + ディスプレイ番号のポートを使用することを示しています。

VNC クライアントから 5900 + ディスプレイ番号 のポートに接続すると、ユーザパスワードを求められるので、先のパスワードを入力することでリモートデスクトップを開くことができます。

VNC クライアントとしては、Windows なら RealVNC Viewer(32bit版, 64bit版)、Mac なら画面共有、iPhone なら VNC Viewer、Android なら RealViewer、Raspberry Pi なら TightVNC viewer 等があります。

例えば Windows で RealVNC (VNC Viewer) を使う場合、Raspberry Pi で vncserver を起動した状態で、Windows から VNC クライアントを起動します。

vnc_client_001

「VNC Server」に ’Raspberry Pi のホスト名:ディスプレイ番号’ を指定します。ディスプレイ番号が1(ポート番号が 5901) の場合は、’ホスト名:1′ と指定します。(ホスト名は IPアドレスでも可)

vnc_client_002

VNCサーバが暗号化に対応していないという警告がでます。

vnc_client_003

指定した VNC サーバのパスワードを入力します。

vnc_client_004

Raspberry Pi のデスクトップが開きます。

 

Usage:

vncserver のコマンドライン引数は以下の通りです。

Usage: vncserver [<OPTIONS>] [:<DISPLAY#>]
       vncserver -kill :<DISPLAY#>

<OPTIONS> are Xtightvnc options, or:

        -name <DESKTOP-NAME>
        -depth <DEPTH>
        -geometry <WIDTH>x<HEIGHT>
        -httpport number
        -basehttpport number
        -alwaysshared
        -nevershared
        -pixelformat rgb<NNN>
        -pixelformat bgr<NNN>

 

vncserver の主なオプション:

-kill :<DISPLAY#>

例) -kill :1

 

  • ディスプレイ番号を指定して vncserver を終了します。(この例では、ディスプレイ番号1の vncserver を終了)

 

-geometry <WIDTH>x<HEIGHT>

例) -geometry 1280x800

 

  • デスクトップサイズを指定します。(この例では 1280×800)

-depth <DEPTH>

例) -depth 24

 

  • デスクトップの色深度を指定します。(この例では 24bit Color)

 

VNC サーバの終了:

-kill オプションを使用して vncserver を終了します。

例) $ vncserver -kill :1

 

  • vncserver をディスプレイ番号を指定して終了します。(この例では、ディスプレイ番号1 の vncserver を終了)

 

パスワードの変更:

パスワードを変更する場合は、変更したユーザにログインした上で、vncpasswd コマンドで変更します。

$ vncpasswd
Using password file /root/.vnc/passwd
Password:******** 
Verify:********
Would you like to enter a view-only password (y/n)? n

 

自動起動設定:

vncserver を手動でいちいち立ち上げるのが面倒という場合には、Raspberry Pi の起動時に自動で vncserver を立ち上げるようにも設定できます。

ユーザ root で 1280×800 24bit Color の vncserver を自動起動するスクリプトです。(必要に応じて vncserver の引数やユーザを変更しましょう。)

#! /bin/sh
# /etc/init.d/vncboot

### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO
 
USER=root
HOME=/root
 
export USER HOME
 
case "$1" in
 start)
   /usr/bin/vncserver :1 -geometry 1280x800 -depth 24
   echo "Starting VNC Server."
   ;;
 
 stop)
   /usr/bin/vncserver -kill :1
   echo "VNC Server Has been stoped."
   ;;
 
 *)
   echo "Usage: /etc/init.d/vncboot {start|stop}"
   exit 1
   ;;
esac
 
exit 0
このスクリプトを vncboot という名前で /etc/init.d に置き、実行属性を付け、自動起動するように設定します。
$ cd /etc/init.d
$ sudo chown root.root vncboot
$ sudo chmod +x vncboot
$ sudo update-rc.d vncboot defaults

これで、Raspberry Pi の起動時に vncserver が自動起動します。

なお、自動起動しないようにするには、次のコマンドで登録を削除します。
$ cd /etc/init.d
$ sudo update-rc.d vncboot remove

 

参考:

TightVNC の X サーバの xdpyinfo の出力結果です。(この例では、デスクトップは 1024×768 24bitColor です。)

$ xdpyinfo
name of display:    :1.0
version number:    11.0
vendor string:    AT&T Laboratories Cambridge
vendor release number:    3332
maximum request size:  4194300 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    2
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
    depth 24, bits_per_pixel 32, scanline_pad 32
keycode range:    minimum 8, maximum 255
focus:  window 0x2c00007, revert to Parent
number of extensions:    7
    BIG-REQUESTS
    MIT-SHM
    MIT-SUNDRY-NONSTANDARD
    SHAPE
    SYNC
    XC-MISC
    XTEST
default screen number:    0
number of screens:    1

screen #0:
  dimensions:    1024x768 pixels (347x260 millimeters)
  resolution:    75x75 dots per inch
  depths (1):    24
  root window id:    0x25
  depth of root window:    24 planes
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x21
  default number of colormap cells:    256
  preallocated pixels:    black 0, white 16777215
  options:    backing-store YES, save-unders YES
  largest cursor:    1024x768
  current input event mask:    0x7a003c
    ButtonPressMask          ButtonReleaseMask        EnterWindowMask          
    LeaveWindowMask          StructureNotifyMask      SubstructureNotifyMask   
    SubstructureRedirectMask FocusChangeMask          PropertyChangeMask       
  number of visuals:    1
  default visual id:  0x22
  visual:
    visual id:    0x22
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

 

Raspberry Pi で x11vnc

x11vnc

x11vnc を使用することで、 Raspberry Pi 本体のデスクトップ(デフォルトの Xサーバ)を VNC クライアントでリモート表示/操作することができます。Raspberry Pi 本体のデスクトップとは別のデスクトップを VNC で使用したい場合は、TightVNC サーバを使用してください。

 

x11vnc
x11vnc

インストール方法:

x11vnc は、apt-get でインストールできます。

$ sudo apt-get install x11vnc

 

次に x11vnc に -storepasswd を指定して起動し、そのユーザのパスワードを設定して VNC サーバのパスワードを保存します。

$ x11vnc -storepasswd

 

自動起動の設定:

startx 実行時 (X サーバ起動時) に自動的に x11vnc を起動するには、以下の内容で ~/.config/autostart/x11vnc.desktop ファイルを作成する必要があります。(Raspbian 起動時に X サーバが自動起動するようになっている場合は、更に VNC サーバも自動起動します。)

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=X11VNC
Exec=x11vnc -usepw -forever
StartupNortify=false
Terminal=false
Hidden=false

 

注意:

VNC サーバのパスワードと x11vnc.desktop ファイルは、X サーバを起動するユーザに対して設定する必要があります。

 

使用方法:

自動起動の設定を行っている場合は、デフォルトの X サーバ(通常、ディスプレイ番号0番)が起動している状態で、ポート 5900 に VNC クライアントで接続します。

接続時のパスワードは、先で保存したパスワードになります。

クライアント側には、Raspberry Pi 本体のデスクトップが表示されます。(デスクトップのサイズはもちろん本体のデスクトップのサイズとなります。)

なお、x11vnc のデスクトップのサイズを変更するには、本体のデスクトップのサイズごと変更する必要があります。(/boot/config.txt の framebuffer_width, framebuffer_height で指定することが可能です。)

raspi_xgears

デフォルトのXサーバは GLX 対応(ただしソフトウェアレンダラ)なので、別マシンの OpenGL アプリケーションをリモート表示することも可能です。

参考:

x11vnc の X サーバ(デフォルトの X サーバ)の xdpyinfo 出力結果です。(この例では、1280×800 サイズ)

$ xdpyinfo
name of display:    :0.0
version number:    11.0
vendor string:    The X.Org Foundation
vendor release number:    11204000
X.Org version: 1.12.4
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    7
supported pixmap formats:
    depth 1, bits_per_pixel 1, scanline_pad 32
    depth 4, bits_per_pixel 8, scanline_pad 32
    depth 8, bits_per_pixel 8, scanline_pad 32
    depth 15, bits_per_pixel 16, scanline_pad 32
    depth 16, bits_per_pixel 16, scanline_pad 32
    depth 24, bits_per_pixel 32, scanline_pad 32
    depth 32, bits_per_pixel 32, scanline_pad 32
keycode range:    minimum 8, maximum 255
focus:  window 0x2200005, revert to Parent
number of extensions:    27
    BIG-REQUESTS
    Composite
    DAMAGE
    DOUBLE-BUFFER
    DPMS
    DRI2
    GLX
    Generic Event Extension
    MIT-SCREEN-SAVER
    MIT-SHM
    RANDR
    RECORD
    RENDER
    SECURITY
    SGI-GLX
    SHAPE
    SYNC
    X-Resource
    XC-MISC
    XFIXES
    XFree86-DGA
    XFree86-VidModeExtension
    XINERAMA
    XInputExtension
    XKEYBOARD
    XTEST
    XVideo
default screen number:    0
number of screens:    1

screen #0:
  dimensions:    1280x800 pixels (339x212 millimeters)
  resolution:    96x96 dots per inch
  depths (7):    16, 1, 4, 8, 15, 24, 32
  root window id:    0xe2
  depth of root window:    16 planes
  number of colormaps:    minimum 1, maximum 1
  default colormap:    0x20
  default number of colormap cells:    64
  preallocated pixels:    black 0, white 65535
  options:    backing-store NO, save-unders NO
  largest cursor:    1280x800
  current input event mask:    0x7a003c
    ButtonPressMask          ButtonReleaseMask        EnterWindowMask          
    LeaveWindowMask          StructureNotifyMask      SubstructureNotifyMask   
    SubstructureRedirectMask FocusChangeMask          PropertyChangeMask       
  number of visuals:    33
  default visual id:  0x21
  visual:
    visual id:    0x21
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    8 bits
  visual:
    visual id:    0xc2
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc3
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc4
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc5
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc6
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc7
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc8
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xc9
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xca
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xcb
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xcc
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xcd
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xce
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xcf
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd0
    class:    TrueColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd1
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd2
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd3
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd4
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd5
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd6
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd7
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd8
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xd9
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xda
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xdb
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xdc
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xdd
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xde
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xdf
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0xe0
    class:    DirectColor
    depth:    16 planes
    available colormap entries:    64 per subfield
    red, green, blue masks:    0xf800, 0x7e0, 0x1f
    significant bits in color specification:    6 bits
  visual:
    visual id:    0x41
    class:    TrueColor
    depth:    32 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

 

Raspberry Pi で VNC

はじめに

VNC(Virtual Network Computing) は、サーバ/クライアントモデルのシステムで、サーバ側のデスクトップをクライアント側で表示/操作することができるリモートデスクトップシステムです。

Mac の画面共有
Mac の画面共有で Raspberry Pi の VNC サーバに接続

例えば、Raspberry Pi で VNC サーバを動かし、Windows や Mac、Linux、スマホ等で VNC クライアントを使うことで、 Raspberry Pi のデスクトップを表示/操作することができます。(MacOS X の場合、画面共有は vnc プロトコルを使用しますので、特別な VNC クライアントを使わなくても Raspberry Pi の VNC サーバに接続することができます。)

VNC は音声をサポートしていないため、サーバ側のサウンドをクライアント側で聞くことはできません。

VNC サーバ

Raspberry Pi で多く利用されている VNC サーバは次の2種類です。

  • TightVNC サーバ
  • x11vnc

 

TightVNC サーバ

TightVNC サーバは、Raspberry Pi 本体のデスクトップとは別にクライアント用のデスクトップを使用することができる VNC サーバです。

Raspberry Pi 本体のデスクトップとは別の X サーバを使用し、解像度も本体側のデスクトップに影響されません。

 

x11vnc

x11vnc は、Raspberry Pi 本体のデスクトップをそのままリモートで操作することができる VNC サーバです。

Raspberry Pi 本体のデスクトップをそのままリモートで操作するため、リモートデスクトップのサイズは Raspberry Pi 本体のデスクトップのサイズと同じになります。

 

Dispmanx VNC Server

特殊な VNC サーバで、Raspberry Pi 本体コンソールをリモートで操作することができる VNC サーバです。

/dev/fb0 の画面だけではなく、Raspberry Pi 本体コンソールに表示される GPU 画面(OpenGL ES, OpenVG アプリケーション)も VNC クライアント側に表示することができます。もちろん、Raspberry Pi 本体のデスクトップの解像度と同じになります。

 

VNC クライアント

VNC サーバに接続して、接続先のデスクトップを表示/操作するためのソフトウェアです。

Windows や Mac、Linux 等で  VNC サーバを動かし、Raspberry Pi で VNC クライアントを動かせば、Raspberry Pi で Windows や Mac、Linux 等の画面表示/操作ができます。

以下は、Raspberry Pi で動く VNC クライアントソフトウェアです。

TightVNC viewer

TightVNC viewer は、一般的な VNC クライアントソフトウェアです。TighgVNC Server に接続する場合には、独自の転送方式の Tight Encoding が使用できます。

krdc

krdc は、Raspberry Pi から Windows や Mac、Linux 等の VNC サーバに接続して、画面表示/操作が可能となる VNC クライアントソフトウェアです。

krdc は、vnc プロトコル以外にも rdp プロトコルに対応していています。そのため、Windows のリモートデスクトップクライアントソフトウェアでもあります。

krdc
krdc

この画面は、Raspberry Pi の krdc で自身の VNC サーバに接続したものです。(ただし、VNC サーバは krdc を実行したデスクトップとは異なるデスクトップを使用しています。)

 

 

Raspberry Pi の仮想キーボード

はじめに

matchbox-keyboard は、Raspberry Pi で使用可能な仮想キーボードのひとつです。(X用の仮想キーボードなのでコンソールでは使えません。)

vkey001

タッチパネルで文字入力するには必須ですね。

VNCやリモートデスクトップで、入力できない記号があったりしますが、そのような場合に仮想キーボードを補助的に使うことができます。あれば便利。

 

インストール方法

$ sudo apt-get install matchbox-keyboard

 

実行方法

メニューから起動することができます。

vkey_menu

コマンドラインからの実行方法は次の通り。

$ matchbox-keyboard &

 

キー配列

標準, us, ru, fi, dvorak, extended, numpad の7種類用意されています。

extended

拡張101英語キーボードです。(ちょっと違うけど)

標準状態

vkey001

 

Shift ロック状態

vkey002

 

キー配列変更

キー配列は設定ファイル(xml) で変更可能です。

 

extended-jis

せっかくなので、JISキーボード風のキー配列の設定ファイルを作ってみました。

https://raspberrypi.akaneiro.jp/src/matchbox/matchbox-keyboard-extended-jis.tar.gz

インストール方法

$ wget https://raspberrypi.akaneiro.jp/src/matchbox/matchbox-keyboard-extended-jis.tar.gz
$ tar xvzf matchbox-keyboard-extended-jis.tar.gz
$ sudo cp keyboard-extended-jis.tar.gz /usr/share/matchbox

 

起動方法

$ matchbox-keyboard extended-jis &

 

標準状態
vkey-jis001

 

Shift ロック状態

vkey-jis002

Raspberry Pi のシリアルナンバー

Raspberry Pi のシリアルナンバーは、コマンドラインから調べることができます。

$ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 2.00
Features : half thumb fastmult vfp edsp java tls&nbsp;
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 0010
Serial : 0000000012345678

 

シリアルナンバーは、MPEG-2, VC-1 コーデックのライセンスを購入する場合に必要になります。

また、複数の Raspberry Pi で同じ SD カードを使い回す場合に、シリアルナンバーフィルタ機能を使って、/boot/config.txt に個別設定を記述する時にも使います。

[0x12345678]
# settings here are applied only to the Pi with this serial
[all]
# settings here are applied to all hardware