From: Johan Hedberg <johan.hedberg@gmail.com>
To: "Gustavo F. Padovan" <padovan@profusion.mobi>,
linux-bluetooth <linux-bluetooth@vger.kernel.org>,
ofono@ofono.org, zhenhua.zhang@intel.com
Subject: Re: [RFC] HFP support into oFono and BlueZ
Date: Thu, 21 Jan 2010 21:27:34 +0200 [thread overview]
Message-ID: <20100121192734.GA31209@jh-x301> (raw)
In-Reply-To: <20100121192209.GA30879@jh-x301>
Hi Gustavo,
Sorry, not only did I manage not to quote the original patch properly
but the mime-type in my mail was scrwed up. Here's a second try:
=================
Sorry about the delay in getting more comments from me. Here's the
result of an initial (and rather quick) review:
+static const char *connected2str(int i)
+{
+ switch (i) {
+ case GATEWAY_STATE_DISCONNECTED:
+ return "disconnected";
+ case GATEWAY_STATE_CONNECTING:
+ return "connecting";
+ case GATEWAY_STATE_CONNECTED:
+ return "connected";
+ case GATEWAY_STATE_PLAYING:
+ return "playing";
+ default:
+ return "";
+ }
+}
This should be called state2str and the state is gateway_state_t and not
int. Also name the variable more apropriately (e.g. "state").
+static void change_state(struct audio_device *dev, int new_state)
Same goes here. gateway_state_t and not int.
+ gw->sco = chan;
+ g_io_channel_ref(chan);
The convention is to do the variable assignment through the return value
of the _ref function. Please do that.
- /* why is this here? */
fcntl(g_io_channel_unix_get_fd(chan), F_SETFL, 0);
Why are you removing this comment? Either remove the fcntl call
altogether, fix the comment to describe why the call is needed or then
don't do anything if you don't know what it's for.
+ if (!dbus_set_error_from_message(&derr, reply)) {
+ info("Agent reply: file descriptor passed successfuly");
+ return;
+ }
I don't think this is worth an info(). Use debug() instead.
+ g_idle_add(gateway_close, gw);
Do you really need to call gateway_close through an idle callback?
What's the problem with calling it directly?
+ /* make /dev/rfcomm serial port from chan */
+ memset(&req, 0, sizeof(req));
+ req.dev_id = -1;
+ req.flags = (1 << RFCOMM_REUSE_DLC);
+ bacpy(&req.src, &dev->src);
+ bacpy(&req.dst, &dev->dst);
+ req.channel = gw->channel;
What's this? I thought you removed all the RFCOMM TTY codde.
+ return;
}
Unnecessary return at the end of a void function.
+ agent = g_new0(struct agent, 1);
+ if (!agent)
+ return g_dbus_create_error(msg,
+ ERROR_INTERFACE ".Failed",
+ "Failed to create a new agent");
g_new0() will either assert or always return non-NULL. Use g_try_new0
if you want to check for failure, but probably you can just remove the
check and keep using g_new0. Btw, src/agent.h already defines a struct
agent so it'd be better if you use another name, e.g. hf_agent.
+ agent->name = strdup(name);
+ agent->path = strdup(path);
Use g_strdup.
+ g_io_channel_ref(chan);
+ dev->gateway->rfcomm = chan;
Again, please do the assignment through the return value of _ref()
There are probably more issues, but these are the ones I found after an
initial glance-through. Please send an updated patch, preferably inline
(since as you notice I didn't manage to get my mailer to properly quote
this time) and I'll take a new look. Thanks.
Johan
next prev parent reply other threads:[~2010-01-21 19:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 17:08 [RFC] HFP support into oFono and BlueZ Gustavo F. Padovan
2010-01-11 19:05 ` Gustavo F. Padovan
2010-01-13 23:39 ` Gustavo F. Padovan
2010-01-18 11:38 ` Luiz Augusto von Dentz
2010-01-17 22:37 ` Denis Kenzior
2010-01-19 8:02 ` Johan Hedberg
2010-01-19 9:30 ` Luiz Augusto von Dentz
2010-01-19 10:33 ` Johan Hedberg
2010-01-19 12:26 ` Luiz Augusto von Dentz
2010-01-20 19:58 ` Gustavo F. Padovan
2010-01-21 6:28 ` Zhang, Zhenhua
2010-01-21 7:54 ` Zhao Forrest
2010-01-21 2:56 ` Denis Kenzior
2012-08-21 22:46 ` Lucas De Marchi
2010-01-21 19:22 ` Johan Hedberg
2010-01-21 19:27 ` Johan Hedberg [this message]
2010-01-27 19:12 ` HFP support into BlueZ and oFono Gustavo F. Padovan
2010-01-27 19:12 ` [PATCH 1/2] clean up audio/gateway.c Gustavo F. Padovan
2010-01-27 19:12 ` [PATCH 2/2] Implement HandsfreeGateway Interface Gustavo F. Padovan
2010-01-27 19:12 ` [PATCH] Add HFP support through BlueZ Gustavo F. Padovan
2010-01-27 20:17 ` Marcel Holtmann
2010-02-01 3:15 ` [PATCH 1/2] clean up audio/gateway.c Zhenhua Zhang
2010-01-27 19:17 ` HFP support into BlueZ and oFono Gustavo F. Padovan
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=20100121192734.GA31209@jh-x301 \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=ofono@ofono.org \
--cc=padovan@profusion.mobi \
--cc=zhenhua.zhang@intel.com \
/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).