hi,
i have a problem in bluetooth bulk write. in the existing (version 0.7 of
bluetooth.c) code, if the free URB is not available, bluetooth_write is
returning number of bytes written so far or zero if nothing is written. but i
want the process to sleep if free urb is not available and wakeup when it is
available. so i have put interruptible_sleep_on() call in the bluetooth_write
function and wake_up_interruptible in the bluetooth_write_bulk_callback
function. but still i am facing some problems. here are the few test cases
and the results,
1. if the user buffer size 6144 ( 128 * 24 * 2) , the write call is
successfull. but if i try to write the same number of bytes (6144), the write
fails after writing 20864 bytes. before failing it has gone to sleep mode and
able to wake up many times whenever the urbs are not available. it goes to
the sleep mode and never wakes up. there is also alog message "VFS: disk
change detected on device ide1(22, 0). i dont know whether this is some thing
to do with the failure. please clarify.
2. if the user buffer size is 10, and if i have the write call in a for loop
with loop count as 6000, it writes successfully 6000 times (60000bytes)and
if run that again, the system hangs after 380th write consistently.
and another problem what i am facing is that if remove the connection from
the usb port or switch off the power supply of the bluetooth board, the
system hangs.
here is the modification what i have done in the bluetooth_write and the
bluetooth_write_bulk_callback functions
1. bluetooth_write()
while (count > 0) {
urb = NULL;
do {
for (i = 0; i < NUM_BULK_URBS; ++i) {
if
(bluetooth->write_urb_pool[i]->status != -EINPROGRESS) {
urb =
bluetooth->write_urb_pool[i];
break;
}
}
if(urb != NULL)
{
break;
}
else
{
/* sleep till you get the
free urb */
dbg (__FUNCTION__ " - no free
urbs so going to sleep mode");
bluetooth->sleep_wakeup_count++;
printk("bluetooth_write: @@@
no free urbs so going to sleep mode %d",bluetooth->sleep_wakeup_count);
interruptible_sleep_on(&bluetooth->write_wait);
/*
seep_on(&bluetooth->write_wait); */
printk("bluetooth_write: @@@
after wake up %d",bluetooth->sleep_wakeup_count);
}
} while(urb == NULL);
2. bluetooth_write_bulk_callback()
if(bluetooth->sleep_wakeup_count > 0)
{
wake_up_interruptible(&bluetooth->write_wait);
/* wake_up(&bluetooth->write_wait); */
bluetooth->sleep_wakeup_count--;
printk("bluetooth_write_bulk_callback: @@@ after tty wake up
%d\n",bluetooth->sleep_wakeup_count);
if anybody could clarify the doubts it would be great.
regards,
ravi kumar b.s.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel