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

[bluetooth-dev] Re: [linux-usb-devel] Suggestion and question for bluetooth.c



Also posted to the bluetooth-dev list for the archives:

--------------------------------------------------

Hi,

On Wed, Nov 22, 2000 at 11:20:17AM +0900, mgkim@xxxxxxx.kr wrote:
> 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.

Why?  Is there a problem with sending large numbers of ACL packets with
the current non-blocking write?

> 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?

No, from what I recall (please someone correct me if I'm wrong) the
urb callback functions for the same device are not called
simultaneously, so this isn't a problem.

thanks,

greg k-h

-- 
greg@xxxxxxx.com
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com