I would like to send a command OCF_LE_READ_CHANNEL_MAP to the hci interface of an adapter using the hci library. To do this, I think I need to open a socket connection to the hci interface of the adapter and obtain the ACL connection handle. My question is, how do I obtain the handle? I try the following, but the ioctl returns -1 with error "File descriptor in a bad state". // find the connection handle to the specified bluetooth device cr = (struct hci_conn_info_req*) malloc( sizeof(struct hci_conn_info_req) + sizeof(struct hci_conn_info)); bacpy( &cr->bdaddr, ba ); cr->type = ACL_LINK; dd = hci_open_dev( hci_get_route( &cr->bdaddr ) ); if( dd < 0 ) { err = dd; goto cleanup; } err = ioctl(dd, HCIGETCONNINFO, (unsigned long) cr ); if( err ) { // !!!This is where the program ends with "File descriptor in bad state" perror("Failed to get connection info"); goto cleanup; } // build a command packet to send to the bluetooth microcontroller cmd_param.handle = cr->conn_info->handle; -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html