zurachu / isd_for_linux

Linux, BSD, macOS で P/ECE と通信するコマンドラインツール
5 stars 2 forks source link

Mac で No such file or directory #5

Closed zurachu closed 6 years ago

zurachu commented 6 years ago
> brew install libusb
> brew install libusb-compat
> cd isd_for_linux ←リポジトリをcloneしたディレクトリ
> make
> ./isd -c
No such file or directory
zurachu commented 6 years ago

http://int.main.jp/prog/lin_piece.html

isdをrootで動かすんだったら別に大丈夫だけど、

と書いてあるけど、sudo ./isd -c ではダメだった。

zurachu commented 6 years ago

usb_open() までは成功している=デバイスは見つかっている。 以下で失敗している。 https://github.com/zurachu/isd_for_linux/blob/master/piecedev.cpp#L56 https://github.com/zurachu/isd_for_linux/blob/master/piecedev.cpp#L74 https://github.com/zurachu/isd_for_linux/blob/master/piecedev.cpp#L88

zurachu commented 6 years ago

https://github.com/libusb/libusb-compat-0.1/blob/master/libusb/core.c#L199-L202 usb_strerror() は strerror(errno) を返している。 "No such file or directory" = ENOENT

https://github.com/libusb/libusb-compat-0.1/blob/master/libusb/core.c#L108-L109 libusb では LIBUSB_ERROR_NOT_FOUND が返ってきていることがわかる。

zurachu commented 6 years ago

usb_set_debug(1); したらもうちょっと情報出てきた。

libusb: warning [ep_to_pipeRef] no pipeRef found with endpoint address 0x02.
libusb: error [submit_bulk_transfer] endpoint not found on any open interface
No such file or directory
zurachu commented 6 years ago

usb_set_debug()での情報がもうちょっと欲しいと思い、libusb 0.1系をビルド、リンクしてusb_set_debug(4);してみたが、デバイスを見つける段階で失敗してしまい、むしろ後退。 https://sourceforge.net/projects/libusb/files/libusb-0.1%20%28LEGACY%29/0.1.12/ 多分USB 3.0のバスから先を見に行けていないので、libusb 1.0系+libusb-compatでないとダメ。

usb_set_debug: Setting debugging level to 4 (on)
usb_os_find_busses: Found 001
usb_os_find_busses: Found 002
usb_os_find_devices: Found USB device at location 0x14000000
usb_os_find_devices: Found 000-05ac-8007-09-ff on 001 at location 0x14000000
usb_os_find_devices: Found USB device at location 0x00000000
usb_os_open: 05ac:8007
usb_os_open(USBDeviceOpenSeize): another process has device opened for exclusive access
usb_control_msg: 128 6 512 0 0x7ffeef676220 8 1000
usb_control_msg: 128 6 512 0 0x7f9246405d80 9 1000
usb_os_close: 05ac:8007
usb_os_find_devices: Found USB device at location 0x14000000
usb_os_find_devices: Found USB device at location 0x00000000
usb_os_find_devices: Found 000-05ac-8007-09-ff on 002 at location 0x00000000
usb_os_open: 05ac:8007
usb_os_open(USBDeviceOpenSeize): another process has device opened for exclusive access
usb_control_msg: 128 6 512 0 0x7ffeef676220 8 1000
usb_control_msg: 128 6 512 0 0x7f92467003c0 9 1000
usb_os_close: 05ac:8007
can't find device
zurachu commented 6 years ago

usb_set_debug(4); で libusb 1.0 のログ取れるよう libusb-compat をカスタマイズ https://github.com/zurachu/libusb-compat-0.1/tree/for_debugging_application

autoreconf --install
./configure --enable-debug-log
make

実行時ログ

libusb-compat debug: usb_init: 
libusb-compat debug: usb_find_busses: 
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.007076] [00000307] libusb: debug [libusb_get_device_list] 
libusb-compat debug: usb_find_busses: bus 0 added
libusb-compat debug: usb_find_busses: bus 20 added
libusb-compat debug: usb_find_devices: 
[ 0.007181] [00000307] libusb: debug [libusb_get_device_list] 
[ 0.007213] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.007259] [00000307] libusb: debug [libusb_get_config_descriptor] index 0
libusb-compat debug: usb_find_devices: device 20.2 added
[ 0.007301] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.007307] [00000307] libusb: debug [libusb_get_config_descriptor] index 0
libusb-compat debug: usb_find_devices: device 20.3 added
[ 0.007323] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.007328] [00000307] libusb: debug [libusb_get_config_descriptor] index 0
libusb-compat debug: usb_find_devices: device 20.4 added
[ 0.007342] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.007346] [00000307] libusb: debug [libusb_get_config_descriptor] index 0
libusb-compat debug: usb_find_devices: device 20.5 added
[ 0.007367] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.007373] [00000307] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.007378] [00000307] libusb: debug [parse_endpoint] skipping descriptor 30
libusb-compat debug: usb_find_devices: device 0.1 added
libusb-compat debug: usb_open: 
[ 0.007448] [00000307] libusb: debug [libusb_open] open 20.4
[ 0.007610] [00000307] libusb: debug [darwin_open] device open for access
libusb-compat debug: usb_bulk_io: endpoint 2 size 2 timeout 500
[ 0.007647] [00000307] libusb: debug [libusb_alloc_transfer] transfer 0x7fd0b2600858
[ 0.007655] [00000307] libusb: debug [libusb_submit_transfer] transfer 0x7fd0b2600858
[ 0.007677] [00000307] libusb: debug [ep_to_pipeRef] converting ep address 0x02 to pipeRef and interface
[ 0.007682] [00000307] libusb: warning [ep_to_pipeRef] no pipeRef found with endpoint address 0x02.
[ 0.007687] [00000307] libusb: error [submit_bulk_transfer] endpoint not found on any open interface
[ 0.007692] [00000307] libusb: debug [libusb_free_transfer] transfer 0x7fd0b2600858
libusb-compat debug: usb_close: 
[ 0.007743] [00000307] libusb: debug [libusb_close] 
Entity not found
[ 0.007820] [00000307] libusb: debug [libusb_exit] 
[ 0.007826] [00000307] libusb: debug [libusb_exit] destroying default context