[SOLVED] Re: Problem with usb4bsd rev566

Hans Petter Selasky hselasky at c2i.net
Wed Jan 16 09:02:01 PST 2008


On Tuesday 15 January 2008, Stefan Lambrev wrote:
> Hi Hans,
>
> Thanks for your response.
> I'm little puzzled right now :)

Hi Stefan,

The order in which the callbacks are called is not that important.

"dropcount" == number of callbacks to call. The xfer[] array is filled 
starting at index 0 up to and including index 3.

If dropcount == 1 then
call callback on xfer[0] only

If dropcount == 2 then
call callback on xfer[1] 
call callback on xfer[0] 

If dropcount == 3 then
call callback on xfer[2] 
call callback on xfer[1] 
call callback on xfer[0] 

This I optimized into a switch statement:

switch(dropcount) {
...
}

Looking at your patch I think you have the old files! Try "svn revert 
usb_transfer.c" and "svn revert usb_port.h" or something similar. I'm at 
revision 568.

Regarding thread_lock and thread_unlock already being defined, you are right.

I've done like this now:

#if (__FreeBSD_version >= 800000)
#define usb_thread_create(f, s, p, ...) \
                kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
#define usb_thread_exit(err)    kproc_exit(err)
#else
#define usb_thread_create(f, s, p, ...) \
                kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
#define usb_thread_exit(err)    kthread_exit(err)
#endif

#if (__FreeBSD_version < 700000)
#define thread_lock(td) mtx_lock_spin(&sched_lock)
#define thread_unlock(td) mtx_unlock_spin(&sched_lock)
#endif

Is this Ok ?

--HPS


More information about the freebsd-usb mailing list