From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: Re: [RFC 15/16] android: Implement basic HAL server
Date: Mon, 30 Sep 2013 11:25:08 +0300 [thread overview]
Message-ID: <20130930082507.GF10262@aemeltch-MOBL1> (raw)
In-Reply-To: <CAJdJm_PMy6pb-NnCc5fKc11ATUwKbSd71HMAWueWkxP_x4Ym=A@mail.gmail.com>
Hi Anderson,
On Fri, Sep 27, 2013 at 01:50:22PM -0400, Anderson Lizardo wrote:
> Hi Andrei,
>
> On Fri, Sep 27, 2013 at 10:12 AM, Andrei Emeltchenko
> <Andrei.Emeltchenko.news@gmail.com> wrote:
> > +static gboolean io_session_event(GIOChannel *chan, GIOCondition cond,
> > + gpointer data)
> > +{
> > + struct hal_msg_hdr hdr;
> > + struct hal_msg_rsp rsp;
> > + uint8_t *buf;
> > + int sock, len, size;
> > + uint8_t status;
> > +
> > + if (cond & G_IO_NVAL)
> > + return FALSE;
> > +
> > + sock = g_io_channel_unix_get_fd(chan);
> > +
> > + if (cond & (G_IO_HUP | G_IO_ERR)) {
> > + error("%s: error condition %d", __func__, cond);
> > + /* TODO: handle */
> > + return FALSE;
> > + }
> > +
> > + len = recv(sock, &hdr, sizeof(hdr), MSG_PEEK);
> > + if (len != sizeof(hdr)) {
> > + /* TODO: handle */
> > + return FALSE;
> > + }
> > +
> > + size = sizeof(hdr) + hdr.len;
> > + buf = malloc(size);
> > + if (!buf)
> > + return TRUE;
> > +
> > + len = recv(sock, buf, size, 0);
> > + if (len != size) {
> > + /* TODO: handle */
> > + free(buf);
> > + return FALSE;
> > + }
> > +
> > + status = process_hal_msg(buf, len);
> > +
> > + free(buf);
> > +
> > + memcpy(&rsp, &hdr, sizeof(hdr));
> > + rsp.hdr.len = sizeof(uint8_t);
> > + rsp.status = status;
>
> You are not using "rsp" on this function (and not TODO comment explaining why).
will fix this.
>
> > + /* Since daemon would be run also on host we have to grant perms */
> > + chmod(sock_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
> > + S_IWOTH);
>
> If it is really necessary to have a world writable socket, better
> explain in detail on the comment.
the problem here is that we need to run this on a host and on Android
where HAL is running under user bluetooth, this has to be changed to use
ifdef logic.
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2013-09-30 8:25 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 14:12 [RFC 00/16] Basic code for Android BlueZ Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 01/16] android: Add Adapter Bluetooth HAL template Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 02/16] android: Add Socket " Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 03/16] android: Enable Socket interface Andrei Emeltchenko
2013-09-27 16:04 ` Anderson Lizardo
2013-09-27 14:12 ` [RFC 04/16] android: Start Android Bluetooth daemon Andrei Emeltchenko
2013-09-29 13:28 ` Marcel Holtmann
2013-09-30 7:07 ` Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 05/16] android: Add Android Makefile for mgmt library Andrei Emeltchenko
2013-09-29 13:34 ` Marcel Holtmann
2013-09-27 14:12 ` [RFC 06/16] android: Add basic mgmt initialization sequence Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 07/16] android: Create HAL API header skeleton Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 08/16] android: Add Android HAL callback task Andrei Emeltchenko
2013-09-29 13:22 ` Marcel Holtmann
2013-09-27 14:12 ` [RFC 09/16] android: Add adapter and device struct for BlueZ daemon Andrei Emeltchenko
2013-09-27 17:07 ` Anderson Lizardo
2013-09-29 13:38 ` Marcel Holtmann
2013-09-30 7:28 ` Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 10/16] android: Add Android Makefile for libbluetooth Andrei Emeltchenko
2013-09-27 18:01 ` Anderson Lizardo
2013-09-30 7:32 ` Andrei Emeltchenko
2013-09-30 12:14 ` Szymon Janc
2013-09-27 14:12 ` [RFC 11/16] android: sdp: Reuse BlueZ SDP server in Android Andrei Emeltchenko
2013-09-29 13:31 ` Marcel Holtmann
2013-09-30 7:45 ` Szymon Janc
2013-09-30 7:47 ` Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 12/16] android: Add cap to bind to port < 1024 Andrei Emeltchenko
2013-09-27 17:17 ` Anderson Lizardo
2013-09-27 17:21 ` Anderson Lizardo
2013-09-29 13:40 ` Marcel Holtmann
2013-09-30 7:36 ` Szymon Janc
2013-09-30 7:51 ` Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 13/16] android: Implement read_info_complete callback Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 14/16] android: Handle mgmt changed events Andrei Emeltchenko
2013-09-27 17:59 ` Anderson Lizardo
2013-09-27 14:12 ` [RFC 15/16] android: Implement basic HAL server Andrei Emeltchenko
2013-09-27 17:50 ` Anderson Lizardo
2013-09-30 8:25 ` Andrei Emeltchenko [this message]
2013-09-30 8:33 ` Marcel Holtmann
2013-09-30 10:26 ` Andrei Emeltchenko
2013-09-29 14:59 ` Johan Hedberg
2013-09-30 8:42 ` Andrei Emeltchenko
2013-09-27 14:12 ` [RFC 16/16] android: Add HAL message helpers Andrei Emeltchenko
2013-09-29 15:00 ` Johan Hedberg
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=20130930082507.GF10262@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=anderson.lizardo@openbossa.org \
--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