X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Fusb%2Fmain.c;h=1429607f891a1a7514457d797d247b3f669d6736;hb=679e5eaaf89efed8e3da5493d32a9db42b02e53e;hp=f32efc2a9a0f15aaea30a1b858d21336c3c18701;hpb=e72388a0aa23da8bc8e24a0cbe9d523c5a9ce294;p=carl9170fw.git diff --git a/carlfw/usb/main.c b/carlfw/usb/main.c index f32efc2..1429607 100644 --- a/carlfw/usb/main.c +++ b/carlfw/usb/main.c @@ -65,7 +65,14 @@ static struct carl9170_rsp *get_int_buf(void) { struct carl9170_rsp *tmp; - tmp = &fw.usb.int_buf[fw.usb.int_tail_index++]; + /* fetch the _oldest_ buffer from the ring */ + tmp = &fw.usb.int_buf[fw.usb.int_tail_index]; + + /* assign a unique sequence for every response/trap */ + tmp->hdr.seq = fw.usb.int_tail_index; + + fw.usb.int_tail_index++; + fw.usb.int_tail_index %= CARL9170_INT_RQ_CACHES; if (fw.usb.int_pending != CARL9170_INT_RQ_CACHES) fw.usb.int_pending++; @@ -152,6 +159,7 @@ static void usb_status_in(void) goto reclaim; } + fw.usb.int_desc->ctrl = AR9170_CTRL_FS_BIT | AR9170_CTRL_LS_BIT; fw.usb.int_desc->totalLen = tlen; fw.usb.int_desc->dataSize = tlen;