From: Bastien Nocera <hadess@hadess.net>
To: Przemo Firszt <przemo@firszt.eu>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
marcel <marcel@holtmann.org>,
Peter Hutterer <peter.hutterer@who-t.net>,
Ping <pinglinux@gmail.com>, Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH 2/2] Add sysfs speed attribute for wacom bluetooth tablet
Date: Thu, 18 Mar 2010 15:37:04 +0000 [thread overview]
Message-ID: <1268926624.21548.1478.camel@localhost.localdomain> (raw)
In-Reply-To: <1268926015.12672.27.camel@pldmachine>
On Thu, 2010-03-18 at 15:26 +0000, Przemo Firszt wrote:
> + unsigned char speed;
Could you add some comments as to what values represent what speed?
> +static ssize_t wacom_store_speed(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct hid_device *hdev = container_of(dev, struct hid_device,
> dev);
> + int new_speed;
> +
> + sscanf(buf, "%1d", &new_speed);
You should check the retval of sscanf as well.
> + if (new_speed == 0 || new_speed == 1) {
> + wacom_poke(hdev, new_speed);
> + return strnlen(buf, PAGE_SIZE);
> + } else
> + return -EINVAL;
> +}
>
> +static DEVICE_ATTR(speed, S_IRUGO | S_IWUGO,
> + wacom_show_speed, wacom_store_speed);
If there's only 2 speeds available, and it's actually a boolean, I'd
rather you used a name like "high_speed".
Furthermore, wdata->speed doesn't look like it's initialised.
Did you test whether speed switching works after the device has been
started up?
Cheers
next prev parent reply other threads:[~2010-03-18 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 15:25 [PATCH 1/2] Add separate mode switching function wacom bluetooth pen tablet Przemo Firszt
2010-03-18 15:26 ` [PATCH 2/2] Add sysfs speed attribute for wacom bluetooth tablet Przemo Firszt
2010-03-18 15:37 ` Bastien Nocera [this message]
2010-03-18 19:12 ` Przemo Firszt
2010-03-22 8:48 ` Jiri Kosina
2010-04-22 19:51 ` Przemo Firszt
2010-04-23 0:16 ` Jiri Kosina
2010-03-18 15:39 ` [PATCH 1/2] Add separate mode switching function wacom bluetooth pen tablet Bastien Nocera
2010-03-22 8:47 ` Jiri Kosina
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=1268926624.21548.1478.camel@localhost.localdomain \
--to=hadess@hadess.net \
--cc=jkosina@suse.cz \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=peter.hutterer@who-t.net \
--cc=pinglinux@gmail.com \
--cc=przemo@firszt.eu \
/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).