メモ
- Install Android 7.1 Nougat on Xperia V - LineageOS 14.1 - Mobileheadlines https://www.mobileheadlines.net/install-android-7-1-nougat-on-xperia-v-lineageos-14-1/
OpenWrtでパケットキャプチャ可能なリピータハブ
TODO
OpenWrtを有線リピータハブとして使用する。
HW
Buffalo WHR-G301N
参考
- OpenFlowをしゃべれるOpenWRT (WHR-G301N) 作成手順 v1.1
この手順書を途中まで進めることでリピータハブとして動作させる。
要点は
- OpenFlowは使用しない
- swconfigでenable learningを0に設定する
- 上記で紹介しているビルド済みイメージではパッチ(http://www.srchack.org/pub/openflow/OpenWRT/OpenWrt-trunk-Learning-Ports-in-AR7240.patch)が適用されており、swconfigでenable learningの設定が可能
設定
/etc/config/network
config 'interface' 'loopback' option 'ifname' 'lo' option 'proto' 'static' option 'ipaddr' '127.0.0.1' option 'netmask' '255.0.0.0' config 'interface' 'wan' option 'ifname' 'eth1' option 'proto' 'static' option 'ipaddr' '192.168.222.111' option 'netmask' '255.255.255.0' config 'switch' option 'name' 'eth0' option 'reset' '1' option 'enable_vlan' '1' option 'enable_learning' '0'
/etc/config/firewall
以下を追記
#Allow SSH config rule option src wan option proto tcp option dest_port ssh option target ACCEPT
/etc/init.d/network
以下を追加
boot() {の最後に /sbin/swconfig dev eth0 set enable_learning 0 # add start() {の最後に /sbin/swconfig dev eth0 set enable_learning 0 # add
Raspberry Pi Zero WでBluetooth
メモ
- RaspberryPi zero + Pythonでアクションカメラを作る
- https://qiita.com/masushin/items/8206bee55c71111813b1
- を参考に以下で動作を確認した。
import evdev from evdev import InputDevice, categorize, ecodes devices = [evdev.InputDevice(path) for path in evdev.list_devices()] for device in devices: print(device.path, device.name, device.phys) dev = evdev.InputDevice('/dev/input/event0') print(dev) dev.capabilities() dev.capabilities(verbose=True) for event in dev.read_loop(): if event.type == ecodes.EV_KEY: print(categorize(event))
pi@raspberrypi:~/bluetooth_shutter $ python evdev_shutter.py ('/dev/input/event0', 'AB Shutter3 ', 'B8:27:EB:xx:xx:xx') device /dev/input/event0, name "AB Shutter3 ", phys "B8:27:EB:xx:xx:xx" key event at 1533192623.166096, 28 (KEY_ENTER), down key event at 1533192623.203584, 115 (KEY_VOLUMEUP), down key event at 1533192623.278570, 115 (KEY_VOLUMEUP), up key event at 1533192623.353599, 28 (KEY_ENTER), up key event at 1533192628.003608, 115 (KEY_VOLUMEUP), down key event at 1533192628.256591, 115 (KEY_VOLUMEUP), hold
- Introduction — Python-evdev
- わずか300円でIoTボタンを作る方法
Raspberry Pi Zero WのSDイメージのバックアップ
Raspberry Piの本体を使用せずにPCでSDカードのイメージを
- バックアップ
- リストア
する場合のメモ。
- GParted Liveを使用してパーティションを(少し)縮小しておく
- SDカードによって容量が異なるので、少しサイズが小さいSDカードにもイメージファイルを書き込みできるように、少し小さめにしておく(例:16GB→15.xGB)
- http://www.maruko2.com/w/index.php?title=GParted_Live_%E7%89%88%E3%82%92_USB_%E3%83%A1%E3%83%A2%E3%83%AA%E3%83%96%E3%83%BC%E3%83%88%E3%81%95%E3%81%9B%E3%82%8B%E6%96%B9%E6%B3%95
- Win32 Disk Imager を使用してSDカードから"Read"でイメージファイルを保存する
- Win32 Disk Imager を使用して(別の)SDカードに"Write"でイメージファイルを書き込む
Raspberry Pi Zero Wの設定
Raspberry Pi Zero Wを購入して初期設定したのでメモ。
実施内容
- イメージのSDカードへの書き込み
- https://www.raspberrypi.org/ から RASPBIAN STRETCH WITH DESKTOP をダウンロード
- Win32DiskImagerを使用してSDカードへ書き込み
- 初期設定
- WiFiで接続(クライアントとして動作)
- APモードに切り替える(アクセスポイントとして動作)
/etc/dnsmasq.conf /etc/hostapd/hostapd.conf /etc/network/interfaces /etc/default/hostapd /etc/dhcpcd.conf
/etc/dhcpcd.conf.wifi /etc/dhcpcd.conf.ap /etc/network/interfaces.wifi /etc/network/interfaces.ap
-
-
- 切り替える
-
APモードへ sudo cp -p /etc/dhcpcd.conf.ap /etc/dhcpcd.conf sudo cp -p /etc/network/interfaces.ap /etc/network/interfaces sudo systemctl enable dnsmasq sudo systemctl enable hostapd sudo service dnsmasq start sudo service hostapd start → リブート WiFiモードへ sudo cp -p /etc/dhcpcd.conf.wifi /etc/dhcpcd.conf sudo cp -p /etc/network/interfaces.wifi /etc/network/interfaces sudo systemctl disable dnsmasq sudo systemctl disable hostapd → リブート