そのときの発表資料です。
皆さん、いろんな物を作ってるんですね。非常に楽しませて頂きました。
Wiiリモコンをファミコンコントローラにしてみた
View more presentations from tocchi02
以前にやりたいと書いた2コン対応ですけど...すぐ出来そうと書きましたが、ベースとしているソフトで複数接続を意識していない(?)ような感じでしたので、大改造が必要とわかり、頓挫しています...
Checking build tools versions... Please install the 10.5 SDK on this machine at /Developer/SDKs/MacOSX10.5.sdk external/qemu/Makefile.android:82: *** Aborting the build.. Stop.
$. build/envsetup.sh $ lunch vbox_x86-eng $ make
$ make showcommands ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.0.1 TARGET_PRODUCT=vbox_x86 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86 HOST_ARCH=x86 HOST_OS=darwin HOST_BUILD_TYPE=release BUILD_ID=ITL41D ============================================ host C: editdisklbl <= bootable/diskinstaller/editdisklbl/editdisklbl.c cc -I bootable/diskinstaller/editdisklbl/../libdiskconfig -I bootable/diskinstaller/editdisklbl -I out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates -I dalvik/libnativehelper/include/nativehelper -isystem system/core/include -isystem hardware/libhardware/include -isystem hardware/libhardware_legacy/include -isystem hardware/ril/include -isystem dalvik/libnativehelper/include -isystem frameworks/base/include -isystem frameworks/base/opengl/include -isystem frameworks/base/native/include -isystem external/skia/include -isystem tools/include -isystem out/host/darwin-x86/obj/include -c -fno-exceptions -Wno-multichar -m32 -fPIC -include system/core/include/arch/darwin-x86/AndroidConfig.h -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -O2 -g -fno-strict-aliasing -DNDEBUG -UDEBUG -O2 -g -W -Wall -Werror -MD -o out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates/editdisklbl.o bootable/diskinstaller/editdisklbl/editdisklbl.c In file included from bootable/diskinstaller/editdisklbl/editdisklbl.c:29: system/core/include/diskconfig/diskconfig.h:100: error: expected specifier-qualifier-list before ‘loff_t’ system/core/include/diskconfig/diskconfig.h:119: error: expected declaration specifiers or ‘...’ before ‘loff_t’ bootable/diskinstaller/editdisklbl/editdisklbl.c: In function ‘main’: bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: ‘loff_t’ undeclared (first use in this function) bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: (Each undeclared identifier is reported only once bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: for each function it appears in.) bootable/diskinstaller/editdisklbl/editdisklbl.c:191: error: expected ‘;’ before ‘offs’ bootable/diskinstaller/editdisklbl/editdisklbl.c:193: error: ‘offs’ undeclared (first use in this function) bootable/diskinstaller/editdisklbl/editdisklbl.c:193: error: too many arguments to function ‘write_raw_image’ make: *** [out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates/editdisklbl.o] Error 1 $ cc -v Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
$. build/envsetup.sh $ lunch full-eng $ make
host C: libelf <= external/elfutils/lib/xmalloc.c In file included from:0: ./external/elfutils/config-compat-darwin.h:42: error: static declaration of ‘strnlen’ follows non-static declaration /usr/include/string.h:143: error: previous declaration of ‘strnlen’ was here make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libelf_intermediates/lib/xmalloc.o] Error 1
host Executable: triangleCM (out/host/darwin-x86/obj/EXECUTABLES/triangleCM_intermediates/triangleCM) Undefined symbols: "__dyld_func_lookup", referenced from: _promoteLocalToGlobal in libSDL.a(SDL_dlcompat.o) _dlcompat_init_func in libSDL.a(SDL_dlcompat.o) _dlcompat_init_func in libSDL.a(SDL_dlcompat.o) _dlcompat_init_func in libSDL.a(SDL_dlcompat.o) ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [out/host/darwin-x86/obj/EXECUTABLES/triangleCM_intermediates/triangleCM] Error 1問題の__dyld_func_lookupは、ここで定義されてました。これがリンクされればいいんでしょうか。未確認です。
$ nm -a /usr/lib/dylib1.10.5.o U ___dso_handle 0000000000000014 T __dyld_func_lookup 0000000000000000 T dyld_stub_binding_helper ootsuka-no-MacBook-Pro:/ ohtsuka$
HCI_CMD_INQUIRY_RESULT: 02 受信データサイズ 02 BTアドレス1 BTアドレス2ただ調べてみると、INQUIRY_RESULT が機器の数だけ返ってくるらしい、ということが分かりました。 確かに、各機器はお互いの状況を知らないので、誰かがとりまとめをしないと上記のような結果は得られないはずです(そしてその役割がINQUIRY COMMANDの発行側...)。
HCI_CMD_INQUIRY_RESULT: 02 0F 01 BTアドレス1 HCI_CMD_INQUIRY_RESULT: 02 0F 01 BTアドレス2
2コン対応、いけそうです。
case HCI_CMD_INQUIRY: //Inquiry (search bluetooth dongles around you) buf1[0]=0x01; buf1[1]=0x04; buf1[2]=0x05; buf1[3]=0x33; buf1[4]=0x8b; buf1[5]=0x9e; buf1[6]=0x05;//waiting time (5 * 1.28 sec) //org buf1[7]=0x01;//if there are bluetooth devices around you, you should give a maximum number here. buf1[7]=0x02;//if there are bluetooth devices around you, you should give a maximum number here. data_size=8; DemoState = BT_STATE_WRITE_CLASS; HciState = HCI_CMD_INQUIRY_RESULT; break;INQUERYの最後の1byteで探索する機器の数を指定できるので、探索機器数を1→2にしてみました。 wiiリモコンを2つ用意して、認識させてみると...INQUIRY RESULT EVENTで返ってくる機器数は1のままでした。 他にまだ対応すべきところがあるんでしょうね、残念。