[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3991181.oZKWSZGdK8@linux-lqwf.site>
Date: Wed, 05 Sep 2012 09:29:49 +0200
From: Oliver Neukum <oneukum@...e.de>
To: Yann Cantin <yann.cantin@...oste.net>
Cc: linux-input@...r.kernel.org, linux-usb@...r.kernel.org,
gregkh@...uxfoundation.org, dmitry.torokhov@...il.com,
linux-kernel@...r.kernel.org, jikos@...e.cz
Subject: Re: [eBeam PATCH 2/2] input: misc: New USB eBeam input driver.
On Sunday 02 September 2012 00:52:03 Yann Cantin wrote:
Hi,
before we add yet another sysfs interface, we should ask whether calibration
isn't a problem that should be solved with a common API.
Regards
Oliver
> +static ssize_t ebeam_calibrated_set(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf,
> + size_t count)
> +{
> + struct ebeam_device *ebeam = dev_get_drvdata(dev);
> + int err, c;
> +
> + err = kstrtoint(buf, 10, &c);
> + if (err)
> + return err;
> +
> + if (c == 1) {
> + memcpy(&ebeam->cursetting, &ebeam->newsetting,
> + sizeof(struct ebeam_settings));
> + ebeam->calibrated = true;
> + ebeam_setup_input(ebeam, ebeam->input);
> + } else {
> + memcpy(&ebeam->newsetting, &ebeam->cursetting,
> + sizeof(struct ebeam_settings));
> + ebeam->calibrated = false;
> + ebeam_setup_input(ebeam, ebeam->input);
> + }
> +
> + return count;
> +}
> +
> +static DEVICE_ATTR(calibrated, S_IRUGO | S_IWUGO,
> + ebeam_calibrated_get, ebeam_calibrated_set);
> +
> +static struct attribute *ebeam_attrs[] = {
> + &dev_attr_min_x.attr,
> + &dev_attr_min_y.attr,
> + &dev_attr_max_x.attr,
> + &dev_attr_max_y.attr,
> + &dev_attr_h1.attr,
> + &dev_attr_h2.attr,
> + &dev_attr_h3.attr,
> + &dev_attr_h4.attr,
> + &dev_attr_h5.attr,
> + &dev_attr_h6.attr,
> + &dev_attr_h7.attr,
> + &dev_attr_h8.attr,
> + &dev_attr_h9.attr,
> + &dev_attr_calibrated.attr,
> + NULL
> +};
> +
--
- - -
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5
90409 Nürnberg
Germany
- - -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists