#include <stdio.h>
#include <fcntl.h>int main()
{
int fd = open("/dev/bt_usb0", O_RDWR);
if (fd < 0) {
fprintf(stderr, "Could not open device.n");
return -1;
}
close(fd);
return0;
}
こんなプログラムを作ってopen/closeを呼び出してみました。
/home/keigo/work/bluetooth/blacktooth/drivers/bt_usb/bt_usb.c: Bluetooth USB driver ver 0.1
usbcore: registered new driver bt_usb
usb 4-2: new full speed USB device using uhci_hcd and address 3
usb 4-2: configuration #1 chosen from 1 choice
/home/keigo/work/bluetooth/blacktooth/drivers/bt_usb/bt_usb.c: USB Bluetooth device now attached to BT_USB-192
/home/keigo/work/bluetooth/blacktooth/drivers/bt_usb/bt_usb.c: Could not find necessary endpoints
bt_usb: probe of 4-2:1.1 failed with error -12
/home/keigo/work/bluetooth/blacktooth/drivers/bt_usb/bt_usb.c: bt_usb_open
/home/keigo/work/bluetooth/blacktooth/drivers/bt_usb/bt_usb.c: bt_usb_release
usb 4-2: USB disconnect, address 3
/home/keigo/work/bluetooth/blacktooth/drivers/bt_usb/bt_usb.c: Bluetooth USB driver now disconnected
ちゃんとopen/releaseが呼ばれています。
また、"Could not find necessary endpoints"というエラー表示が見えます。
やはり2つ目のインターフェース(SCO通信用)でもprobeが呼ばれているようです。