From: Bastien Nocera <hadess@hadess.net>
To: "Ruslan N. Marchenko" <rufferson@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] PS3Remote unpairing and power-saving
Date: Fri, 18 Sep 2009 12:10:22 +0100 [thread overview]
Message-ID: <1253272222.18963.4109.camel@localhost.localdomain> (raw)
In-Reply-To: <a70b8cd30908280742k6cdcaa2l3a267661fe1da17d@mail.gmail.com>
On Fri, 2009-08-28 at 16:42 +0200, Ruslan N. Marchenko wrote:
> PS3 BD Remote driver in fakehid is not able to detect remote unpairing, thus
> not handling it properly.
> Also it keeps permanent BT link with remote controller, which drains batteries.
> With these changes it now utilize IdleTimeout to implicitly unpair device,
> forcing it to enter low power sleep mode.
> IdleTimeout is treated in seconds, in contrast with default - minutes.
> HID device is created on first pairing, and then kept cached till the end of
> daemon life, allowing pairing key-presses to be sent to application with minimum
> delays.
> HID is distinguished by vendor/product codes, which restricts it to only single
> HID for all registered and active PS3 BD Remote controllers.
Please split your patch into 2:
- one part for the disconnect timeout
- one for the PS button disconnecting the remote
Also, don't call it "unpair", it's not paired in the first place, and it
doesn't unpair it, it disconnects it.
<snip>
> + fake_hid->timeout = iconn->timeout/60;
Have the timeout be either in seconds, or minutes, don't mix them up.
<snip>
> +static gboolean ps3remote_sendkey(int uinput, unsigned int key,
> + unsigned int value)
> +{
> + struct uinput_event event;
> + memset(&event, 0, sizeof(event));
Add a linefeed after declarations.
<snip>
> static gboolean ps3remote_event(GIOChannel *chan, GIOCondition cond,
> gpointer data)
> {
> + static unsigned int lastkey = 0;
> + static unsigned int lastval = 0;
Don't use statics, add those to a ps3 specific struct.
<snip>
> + g_timer_start(((struct fake_hid *)fake->priv)->timer);
Why do you start the timer unconditionally, instead of just when using
the HOME key?
<snip>
> -failed:
> +failed: /*
> ioctl(fake->uinput, UI_DEV_DESTROY);
> close(fake->uinput);
> - fake->uinput = -1;
> + fake->uinput = -1;*/
That looks very wrong to me.
Cheers
next prev parent reply other threads:[~2009-09-18 11:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-28 14:42 [PATCH] PS3Remote unpairing and power-saving Ruslan N. Marchenko
2009-09-09 9:06 ` Ruslan N. Marchenko
2009-09-18 11:10 ` Bastien Nocera [this message]
2009-09-18 13:31 ` Ruslan N. Marchenko
2009-09-18 13:49 ` Bastien Nocera
2009-09-23 18:14 ` Ruslan N. Marchenko
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=1253272222.18963.4109.camel@localhost.localdomain \
--to=hadess@hadess.net \
--cc=linux-bluetooth@vger.kernel.org \
--cc=rufferson@gmail.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