私的メモ。
はじめに
Debian/Ubuntu/Fedoraなどのモダンなディストリビューションなら繋いでUSBテザリングを有効にするだけでNetworkManagerに現れるはず。以下の手順はおそらく不要。
必要なカーネルモジュールを構築する
公式USBテザリングはRNDIS経由になるのでUSB_NET_RNDIS_HOSTを有効にすれば良い。まさかこんなところで「W-ZERO3とLinuxでActiveSync」の経験が生きてくるとは。
必要なものはHost for RNDIS and ActiveSync devices(CONFIG_USB_NET_RNDIS_HOST)。
# cd /usr/src/linux # make menuconfig General setup ---> [*] Prompt for development and/or incomplete code/drivers Device Drivers ---> [*] Network device support ---> USB Network Adapters ---> <M> Multi-purpose USB Networking Framework <M> Host for RNDIS and ActiveSync devices (EXPERIMENTAL)
Gentooの設定例。RNDISではAndroid側がDHCPサーバになるのでdhcpcdもインストール。
# cd /etc/init.d # ln -s net.lo net.usb0 # emerge dhcpcd
AndroidとLinuxをUSBで接続し、Androidの「設定」→「無線とネットワーク」→「テザリング」→「USBテザリング」を選択。Linux側でモジュールが自動的に読み込まれない場合ば手動でmodprobe。
# lsusb (USBテザリング有効前) Bus 001 Device 004: ID 0bb4:0c02 High Tech Computer Corp. ... Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk (Zip) iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 66 bInterfaceProtocol 1 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 ... # lsusb (USBテザリング有効後) Bus 001 Device 005: ID 0bb4:0ffc High Tech Computer Corp. ... Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 3 RNDIS iInterface 4 RNDIS Communications Control ** UNRECOGNIZED: 05 24 00 10 01 ** UNRECOGNIZED: 05 24 01 00 01 ** UNRECOGNIZED: 04 24 02 00 ** UNRECOGNIZED: 05 24 06 00 01 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 9 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 10 CDC Data bInterfaceSubClass 0 Unused bInterfaceProtocol 0 iInterface 5 RNDIS Ethernet Data Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 ... # modprobe rndis_host # dmesg ... usbcore: registered new interface driver cdc_ether rndis_host 1-8:1.0: usb0: register 'rndis_host' at usb-0000:00:1d.7-8, RNDIS device, da:aa:0b:4c:ea:34
ip(iproute2)もしくはifconfigでusb0*1が見えるか確認。IPアドレスが取得できてない場合は手動でdhcpcdを動作させてみる。
# ip addr (もしくはifconfig) 4: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether da:aa:0b:4c:ea:34 brd ff:ff:ff:ff:ff:ff inet 192.168.42.28/24 brd 192.168.42.255 scope global usb0 inet6 fe80::d8aa:bff:fe4c:ea34/64 scope link valid_lft forever preferred_lft forever # dhcpcd usb0 (IPアドレスが設定されない場合のみ)
公式USBテザリングが使えない場合の代替案
無料で使えてプロトコルの制約なく使える点でAziLinkがオススメ。AZiLinkの使い方は「Android端末+Gentooでテザリングする方法」をどうぞ。
*1:環境によって異なるかも