[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Suggestion and question for USB bluetooth driver



Title: Suggestion and question for USB bluetooth driver

This message is also sent to linux usb-dev mailing list.
-------------------------------------
Dear Greg, Mark and folks,
 
I am using the version 0.6 (10/05/2000) for USB bluetooth driver.
I am using Sigma Comtec, Bluetooth Application Tool Kit.
I am using user mode Bluetooth protocol stack.
 
1. Suggestion
In the function "static int bluetooth_write (...)",
how about to change the non-blocking write
 
FILL_BULK_URB (urb, bluetooth->dev, usb_sndbulkpipe(bluetooth->dev, bluetooth->bulk_out_endpointAddress),
                                                new_buffer, buffer_size, bluetooth_write_bulk_callback, bluetooth);
urb->transfer_flags |= USB_QUEUE_BULK;
 
// send it down the pipe
status = usb_submit_urb(urb);
 
to the blocking write
 
status = usb_bulk_msg(bluetooth->dev, usb_sndbulkpipe(bluetooth->dev, bluetooth->bulk_out_endpointAddress),
                        new_buffer, buffer_size, &actual_length, 1000);
 
The change seems to be stable
when I send large number of ACL packets.
 
2. Question
Can the two callback functions
 
static void bluetooth_int_callback (struct urb *urb) {  // this is for Event packets
        if (packet_size + EVENT_HDR_SIZE == bluetooth->int_packet_pos){
                for (i = 0; i < bluetooth->int_packet_pos; ++i)
                        tty_insert_flip_char(bluetooth->tty, bluetooth->int_buffer[i], 0);
                tty_flip_buffer_push(bluetooth->tty);
 
                bluetooth->int_packet_pos = 0;
        }
}
 
and
 
static void bluetooth_read_bulk_callback (struct urb *urb)  // this is for incoming ACL packets
{
..
        if (packet_size + ACL_HDR_SIZE == bluetooth->bulk_packet_pos) {
                for (i = 0; i < bluetooth->bulk_packet_pos; ++i)
                        tty_insert_flip_char(bluetooth->tty, bluetooth->bulk_buffer[i], 0);
                tty_flip_buffer_push(bluetooth->tty);
                bluetooth->bulk_packet_pos = 0;
        }
...    
}
 
be called simultaneously?
 
If they can be,
the two calls "tty_insert_flip_char" can mix up parts of Event and ACL packets?
 
---
Myunggyu Kim
mgkim@xxxxxxx.kr