イマドキBSD I/O 2012

2012年11月07日(金) KOF2012 BSDなひととき

むとうたけし@K*BUG <mutoh@openedu.org>

*BSDとI/O

本当にレガシーなインタフェース

イマドキはついているように思えても、USBの先に居たりする。

レガシーなインタフェース

fuji_io.png
ppc0: <Standard parallel printer port> at port 0x378-0x37f irq 7 pnpid PNP0400 on isa0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE modef
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 4 pnpid PNP0501 on isa0

USB, USB, USB!!

USBシリアル3兄弟+1; USBシリアル

USBシリアルのdmesg; USBシリアル

uftdi0 at uhub2 port 1
uftdi0: FTDI FT232R USB UART, rev 2.00/6.00, addr 2
ucom0 at uftdi0 portno 1
uplcom0 at uhub1 port 1 "Prolific Technology Inc. USB-Serial Controller" rev 1.10/3.00 addr 2
ucom0 at uplcom0
uhub4 at uhub0 port 1 "Genesys Logic USB2.0 Hub" rev 2.00/32.98 addr 4
umodem0 at uhub4 port 4 configuration 1 interface 0 "vendor 0x09b9 product 0x0000" rev 2.00/0.00 addr 5
umodem0: data interface 1, has no CM over data, has no break
umodem0: status change notification available
ucom0 at umodem0

デバイス使用上の注意; USBシリアル

デバイスのパーミッションに注意

vaio-p:~ [12-11-04T7:49] % ls -l /dev/ttyU0 
crw-rw----  1 uucp  dialer   66,   0 Nov  4 07:49 /dev/ttyU0
teokure-% ls -l /dev/ttyU0
crw-------  1 uucp  wheel  66, 0 Oct 17 23:55 /dev/ttyU0
insp700m [ ~ ] % ls -l /dev/ttyU0
crw-------  1 root  wheel  0x6f 11月  7 11:46 /dev/ttyU0

シリアルパーミッションの解決方法; デバイス使用上の注意

vaio-p:~ [12-11-04T7:51] % egrep dial /etc/group
dialer:*:117:mutoh
teokure-% egrep wheel /etc/group 
wheel:*:0:root,mikutter

FreeBSDの場合; シリアルパーミッションの解決方法

kohjin:~ [12-11-05T13:51] % egrep tty /etc/devfs.conf
own     ttyU*   operator:operator
perm    ttyU*   0660
attach 10 {
       device-name             "umodem[0-9]+";
       action                  "chmod 666 /dev/ttyU*";
       action                  "chmod 666 /dev/cuaU*";
};
attach 10 {
       device-name             "uplcom[0-9]+";
       action                  "chmod 666 /dev/ttyU*";
       action                  "chmod 666 /dev/cuaU*";
};
attach 10 {
       device-name             "uftdi[0-9]+";
       action                  "chmod 666 /dev/ttyU*";
       action                  "chmod 666 /dev/cuaU*";
};

おまけ; 謎USBデバイス

ugen0.3: <vendor 0x049f> at usbus0
uipaq0: <vendor 0x049f product 0x0003, rev 1.00/0.00, addr 3> on usbus0
ums0: <EndPoint1 Interrupt Pipe> on usbus0
ums0: error reading report description
device_attach: ums0 attach returned 12
ugen2.2: <Diamond Multimedia> at usbus2
urio0: <Diamond Multimedia Diamond Multimedia  Digital Audio Player, class 0/0, rev 1.00/1.00, addr 2> on usbus2
ugen2.2: <Diamond Multimedia> at usbus2
urio0: <Diamond Multimedia Diamond Multimedia  Digital Audio Player, class 0/0, rev 1.00/1.00, addr 2> on usbus2

Physical Computingとは?; Physical Computing

Physical Computing 3兄弟

Gainer; Physical Computing 3兄弟

Arduino; Physical Computing 3兄弟

Sensor Board; Physical Computing 3兄弟

Scratch / Squeak TIPS

  (snip)
00080050  5D 08 83 FE 09 C7 03 2F 64 65 76 C7 43 04 2F 74 ⇒
 ⇒ ]....../dev.C./t
00080060  74 79 66 C7 43 08 55 30 C6 43 0A 00 7F 0F 89 1C ⇒
 ⇒ tyf.C.U0.C......
  (snip)

付録基板の世界

boards.jpeg

付録基板を選ぶには…

Future works

*BSDで、一緒に遊びませんか!!