From: Jui-Hao Chiang <windtracekimo@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] [Patch] Flush Occurred Event
Date: Sat, 23 Aug 2008 19:33:31 +0000 (UTC) [thread overview]
Message-ID: <loom.20080823T192730-77@post.gmane.org> (raw)
In-Reply-To: loom.20080822T022926-635@post.gmane.org
>
The following is a patch against 2.6.22 kernel to catch HCI "Flush Occurred"
event. (meaningful for ACL; useless for SCO)
One more thing to NOTICE is that the handle in the event packet from my adapter
seems to be "Big Endian", so that I use ntohs to convert it.
Normally it should be __le16_to_cpu(ev->handle)
diff -r linux-source-2.6.22/include/net/bluetooth/hci_core.h
patch-2.6.22/include/net/bluetooth/hci_core.h
27a28
>
diff -r linux-source-2.6.22/include/net/bluetooth/hci.h
patch-2.6.22/include/net/bluetooth/hci.h
587a588,595
> /* Flush Occurred Event JuiHao --*/
> #define HCI_EV_FLUSH_OCCURRED 0x11
> #define NUM_OF_FLUSH_PKT 0x1
> struct hci_ev_flush_occurred {
> __le16 handle;
> } __attribute__ ((packed));
> /* --Flush Occurred Event JuiHao */
>
diff -r linux-source-2.6.22/net/bluetooth/hci_event.c
patch-2.6.22/net/bluetooth/hci_event.c
854a855,882
> /* Flush Occurred packet JuiHao*/
> static inline void hci_flush_occurred_evt(struct hci_dev *hdev, struct sk_buff
*skb)
> {
> struct hci_ev_flush_occurred *ev = (struct hci_ev_flush_occurred *) skb->data;
> struct hci_conn *conn;
>
> tasklet_disable(&hdev->tx_task);
>
> BT_DBG("handle is %x, skb->len %d\n", ev->handle, skb->len);
>
> /* The handle returned is probably Big Endian such that __le16_to_cpu is
useless*/
> conn = hci_conn_hash_lookup_handle(hdev, ntohs(ev->handle));
>
> if (conn) {
> atomic_sub(NUM_OF_FLUSH_PKT, &conn->sent);
>
> if (conn->type == ACL_LINK) {
> if ((hdev->acl_cnt += NUM_OF_FLUSH_PKT) > hdev->acl_pkts)
> hdev->acl_cnt = hdev->acl_pkts;
> }
> BT_DBG("conn %p type %d hdev->acl_cnt %d conn->sent %d",
> conn, conn->type, hdev->acl_cnt, atomic_read(&conn->sent));
> }
> hci_sched_tx(hdev);
>
> tasklet_enable(&hdev->tx_task);
> }
>
1289a1318,1322
> /* handle Flush Occurred Event JuiHao --*/
> case HCI_EV_FLUSH_OCCURRED:
> hci_flush_occurred_evt(hdev, skb);
> break;
> /* -- handle Flush Occurred Event JuiHao */
Bests,
Jui-Hao
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2008-08-23 19:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 2:41 [Bluez-devel] Problem automatic flush timeout Jui-Hao Chiang
2008-08-22 14:03 ` Jui-Hao Chiang
2008-08-23 19:33 ` Jui-Hao Chiang [this message]
2008-08-23 20:22 ` [Bluez-devel] [Patch] Flush Occurred Event Marcel Holtmann
2008-08-23 21:13 ` Jui-Hao Chiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20080823T192730-77@post.gmane.org \
--to=windtracekimo@gmail.com \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox