- model B
- 2012/08/23
Table of Contents
メモ
- USBポートに給電される電流は100mA程度らしい
- HUB経由でGW-USValue-EZが特に設定なしで使えてる (Raspbian wheezy 2013-05-25)
- 1~2日運用してると切れてることがある(挿し直すと動き出す)
ネタ
- 外で使う
- 1800mAhのLi-ionバッテリで2.5h動いたとか
- QE-PL301あたりを使えば10時間ぐらいいける?
- 無線AP化
- AirPlay化
DisplayLinkなUSBモニタを繋ぐ
- Raspberry Pi にHDMI->VGA変換器と、USBディスプレイをつなぐ|たけおか ぼちぼち日記
- CONFIG_FB_UDL=mにしてカーネルリビルド
- つらいのでudlfb.koだけビルドしたい
- rpi-updateしておく
- 参考: Raspberry Pi でUSBディスプレイを使う - 猫ぱーんち!
- Module.symversを入手 https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
- % make M=drivers/video/fbdev
- X.org
- コンソール
- こっちのほうがナウい (2018/06/26)
- Raspberry Pi 2 Model B で安いRaspberry用タッチ液晶(LCD)を使う
- カーネルリビルドも不要 (4.14.34-v7+)
参考
モバイルVPNルータを作りたい
DCモーターの制御
NFS root
- Raspberry Pi をNFS root 環境で起動する | treffen @ memo
-
youresuchageek: Howto: Raspberry Pi Root NFS share - boot your System over NFS share and definitively deal with Flash data corruption
- NOOBSでインストールした環境だとパーティション構成がちょっと違う
- NOOBS partitioning explained · raspberrypi/noobs Wiki · GitHub
- rsync -av –numeric-ids /mnt/ /export/nfsroot/hogehoge
- Raspberry PiをNFSrootで起動する - 組み込みの人。
ネットワークブート
うちの環境の場合
- tftpサーバとnfsサーバはQNAPのNASにやらせる
- tftpサーバのルートは
/nfsroot/tftpboot
- サーバのディレクトリ構成
/nfsroot/tftpboot/bootcode.bin
/nfsroot/tftpboot/(serial)/cmdline.txt
/nfsroot/tftpboot/(serial)/config.txt
/nfsroot/tftpboot/(serial)/start.elf
:
/nfsroot/raspberry_pi/(serial)/home
:
-
serialは
/proc/cpuinfo
を参照 - うちの環境だと
cmdline.txt
のnfsroot
にtcp
を付けないとNFSマウント後にNFS server x.x.x.x not responding still trying.
となって進まなくなったnfsroot=x.x.x.x:/nfsroot/raspberry_pi/(serial),rsize=32768,wsize=32768,vers=3,tcp
- dhcpdの場合tftpサーバの指定は
next-server
ではなくoption tftp-server-name
raspi-configが動かなくなる
-
/boot
のマウント元がブロックデバイスでないと弾かれる? - 取り急ぎチェックしている箇所をコメントアウト
--- /usr/bin/raspi-config.orig 2017-07-05 01:33:31.000000000 +0900
+++ /usr/bin/raspi-config 2020-05-08 22:11:48.482162457 +0900
@@ -1641,10 +1641,10 @@
# Interactive use loop
#
if [ "$INTERACTIVE" = True ]; then
- if is_pi && ! mountpoint -q /boot; then
- whiptail --msgbox "The boot partition is not mounted - cannot configure. Note that raspi-config is intended for use on Raspbian only and cannot be guaranteed to work on other operating systems." 20 60 1
- exit 1
- fi
+ #if is_pi && ! mountpoint -q /boot; then
+ # whiptail --msgbox "The boot partition is not mounted - cannot configure. Note that raspi-config is intended for use on Raspbian only and cannot be guaranteed to work on other operating systems." 20 60 1
+ # exit 1
+ #fi
[ -e $CONFIG ] || touch $CONFIG
get_init_sys
calc_wt_size
Zero
- A+で動いていたmicroSDを持ってきて起動しない場合はrpi-updateしてみる
3 Model B with Arch Linux ARM
Bluetooth
-- Unit brcm43xx-firmware.service has begun starting up.
Apr 22 00:52:49 aurora brcm43xx-firmware-update[432]: Warning: Using self generated MAC address!
MAC_ADDR should be defined in /etc/conf.d/bcm43xx.
Apr 22 00:52:49 aurora brcm43xx-firmware-update[432]: Failed: Unable to locate bluetooth device
Apr 22 00:52:49 aurora systemd[1]: brcm43xx-firmware.service: Main process exited, code=exited, status=1/FAILURE
Apr 22 00:52:49 aurora systemd[1]: Failed to start Broadcom 43xx firmware update.
# /usr/lib/systemd/scripts/brcm43xx-firmware-update
Warning: Using self generated MAC address! MAC_ADDR should be defined in /etc/conf.d/bcm43xx.
Failed: Unable to locate bluetooth device
# cat /sys/class/mmc_host/mmc*/mmc?\:0001/mmc?:0001:?/device
0xa9a6
0xa9a6
- BCM4330じゃなくてBCM43430が載ってる?
USB GPSドングル(VK-172)を使う
- VFAN UG-353 も同じように使えてる
gpsdで
# apt-get install gpsd
- /etc/udev/rules.d/60-gpsd.rules
- https://gist.github.com/n13i/0057a56290b62763241ec9375f420c75
-
# udevadm control --reload-rules
して挿し直す # apt-get install gpsd-clients
% cgps
Bluetooth経由でAndroidに位置情報を渡す
Raspberry Pi側
- Serial Port Profileを追加
# sdptool add --channel=22 SP
- なんで22なのかは知らん
- リブートすると元に戻っちゃうみたい
- ペアリング
- bluetoothctl
- scan on
- pair XX:XX:XX:XX:XX:XX
- trust XX:XX:XX:XX:XX:XX
- USB GPSを挿す
- 以下,デバイス名は /dev/ttyACM0 を想定
- Androidからの接続を待ち受ける
# rfcomm listen /dev/rfcomm0 22
- なんで22なのかは知らん
- 接続されると /dev/rfcomm0 が生える
- socatでttyACM0からrfcomm0へデータを流す
% socat /dev/ttyACM0 /dev/rfcomm0
- まとめると
# rfcomm watch /dev/rfcomm0 22 socat /dev/ttyACM0 /dev/rfcomm0
- gpsdを経由する場合
- gps2bt.sh
#!/bin/sh
/usr/bin/gpspipe -r | /usr/bin/socat $1
- みたいなのを作っておいて
# rfcomm watch /dev/rfcomm0 22 /foo/bar/gps2bt.sh /dev/rfcomm0
Android側
参考
- Raspberry Pi 2にBluetoothシリアル通信でデータ送受信してみた - カタカタブログ
- RaspberryPi (jessie)とMac間のBluetooth通信[16/10/12時点 最新版] - Qiita
- How do I connect and send data to a bluetooth serial port on Linux? - Unix & Linux Stack Exchange
UDP越しバージョン
GPIO入力でシャットダウンする
Bluetoothリモコンを繋いでみる
- カシムラ BL-53
- 真ん中のボタン長押しでペアリング
% bluetoothctl
[bluetooth]# scan on
[bluetooth]# pair DC:2C:26:XX:XX:XX
[bluetooth]# trust DC:2C:26:XX:XX:XX
[bluetooth]# connect DC:2C:26:XX:XX:XX
[BL-53]# exit
% cat /proc/bus/input/devices
I: Bus=0005 Vendor=0a5c Product=4502 Version=011b
N: Name="BL-53"
P: Phys=b8:27:eb:XX:XX:XX
S: Sysfs=/devices/platform/soc/20201000.serial/tty/ttyAMA0/hci0/hci0:12/0005:0A5C:4502.0001/input/input0
U: Uniq=dc:2c:26:XX:XX:XX
H: Handlers=kbd event0
B: PROP=0
B: EV=13
B: KEY=2000000 3878 d8011001 e0000 0 0 0
B: MSC=10
-
一旦connectしないとBL-53側がペアリング完了を認識しないかも
% cat /dev/input/event0 | od -t x1
-
よくわからんけどkey up/key downの情報は取れてそう
-
bluebuttonを改造してメディアボタンを押したらコマンド実行できるようにする
- mpcを呼ぶ想定
WiFi Managed + AP
% sudo hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.ap0: -95 (Operation not supported)
ap0: Could not connect to kernel driver
Using interface ap0 with hwaddr b8:27:eb:XX:XX:XX and ssid "Aurora"
- これまでは /etc/network/interfaces には特に設定がなかった
- BT-PANと併用する場合は bnep0 に対する設定を追加しないとないかも
allow-hotplug bnep0
iface bnep0 inet dhcp
Bluebuttonを使ってみる
$ git clone https://github.com/kinnalru/bluebutton
$ sudo apt install ruby
$ sudo gem install device_input
$ sudo gem install slop
非X11環境でグラフィックしたい
SDL2
- Raspberry Pi - Building SDL 2 on Raspbian | Solarian Programmer
-
Cross compiling SDL (succesful) - Raspberry Pi Forums
- https://github.com/raspberrypi/tools
- gcc-linaro-arm-linux-gnueabihf-raspbian-x64
- Installing SDL2 on rpi3
- dotsha747/libsdl2-rpifb: Repackage of libsdl2 for Raspbian “Stretch”, compile for Raspberry Pi Frame Buffer