Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 180204
b: refs/heads/master
c: 6bf8268
h: refs/heads/master
v: v3
  • Loading branch information
Bastien Nocera authored and Marcel Holtmann committed Jan 30, 2010
1 parent 08bcb53 commit 953b19e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9670d80a9a6e24725c4111bef5d6cc7786ad0dc5
refs/heads/master: 6bf8268f9a91f1065c99503161ebd061492bebe3
70 changes: 36 additions & 34 deletions trunk/net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,39 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb)
input_sync(dev);
}

static int __hidp_send_ctrl_message(struct hidp_session *session,
unsigned char hdr, unsigned char *data, int size)
{
struct sk_buff *skb;

BT_DBG("session %p data %p size %d", session, data, size);

if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
BT_ERR("Can't allocate memory for new frame");
return -ENOMEM;
}

*skb_put(skb, 1) = hdr;
if (data && size > 0)
memcpy(skb_put(skb, size), data, size);

skb_queue_tail(&session->ctrl_transmit, skb);

return 0;
}

static inline int hidp_send_ctrl_message(struct hidp_session *session,
unsigned char hdr, unsigned char *data, int size)
{
int err;

err = __hidp_send_ctrl_message(session, hdr, data, size);

hidp_schedule(session);

return err;
}

static int hidp_queue_report(struct hidp_session *session,
unsigned char *data, int size)
{
Expand Down Expand Up @@ -282,7 +315,9 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep

static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
{
if (hidp_queue_report(hid->driver_data, data, count))
if (hidp_send_ctrl_message(hid->driver_data,
HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE,
data, count))
return -ENOMEM;
return count;
}
Expand All @@ -307,39 +342,6 @@ static inline void hidp_del_timer(struct hidp_session *session)
del_timer(&session->timer);
}

static int __hidp_send_ctrl_message(struct hidp_session *session,
unsigned char hdr, unsigned char *data, int size)
{
struct sk_buff *skb;

BT_DBG("session %p data %p size %d", session, data, size);

if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
BT_ERR("Can't allocate memory for new frame");
return -ENOMEM;
}

*skb_put(skb, 1) = hdr;
if (data && size > 0)
memcpy(skb_put(skb, size), data, size);

skb_queue_tail(&session->ctrl_transmit, skb);

return 0;
}

static inline int hidp_send_ctrl_message(struct hidp_session *session,
unsigned char hdr, unsigned char *data, int size)
{
int err;

err = __hidp_send_ctrl_message(session, hdr, data, size);

hidp_schedule(session);

return err;
}

static void hidp_process_handshake(struct hidp_session *session,
unsigned char param)
{
Expand Down

0 comments on commit 953b19e

Please sign in to comment.