From: Manuel Reimer <mail+linux-bluetooth@m-reimer.de>
To: linux-bluetooth@vger.kernel.org
Subject: How to get bluetooth HID reports?
Date: Tue, 1 Mar 2016 19:34:01 +0100 [thread overview]
Message-ID: <56D5E099.3070304@m-reimer.de> (raw)
Hello,
I got stuck with trying to read data from a bluetooth HID device.
Is there some trick when doing this?
Short snippet of my code:
// allocate a socket
int int_socket = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
int ctl_socket = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
// set the connection parameters
addr.l2_family = AF_BLUETOOTH;
str2ba( dest, &addr.l2_bdaddr );
// connect to server
addr.l2_psm = htobs(L2CAP_PSM_HIDP_INTR);
status = connect(int_socket, (struct sockaddr *)&addr, sizeof(addr));
if (status != 0) {
printf("Error connect int_socket\n");
exit(1);
}
addr.l2_psm = htobs(L2CAP_PSM_HIDP_CTRL);
status = connect(ctl_socket, (struct sockaddr *)&addr, sizeof(addr));
if (status != 0) {
printf("Error connect ctl_socket\n");
exit(1);
}
// get a message
char buf[100] = { 0 };
int bytes_read = recv(int_socket, buf, sizeof(buf), 0);
if( bytes_read > 0 ) {
printf("received [%s]\n", buf);
}
I get connected somehow and I am actually able to do interaction on the
"control socket" (writing and reading), but the "recv" at the "interrupt
socket" just hangs forever and I don't know how to debug...
Thanks for every help.
Best regards,
Manuel
next reply other threads:[~2016-03-01 18:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 18:34 Manuel Reimer [this message]
2016-03-02 17:50 ` How to detach device from "hidp"? (was: How to get bluetooth HID reports?) Manuel Reimer
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=56D5E099.3070304@m-reimer.de \
--to=mail+linux-bluetooth@m-reimer.de \
--cc=linux-bluetooth@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).