Re: [eBeam PATCH 2/2] input: misc: New USB eBeam input driver.
From: Oliver Neukum <hidden>
Date: 2012-09-05 07:31:11
Also in:
lkml
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
quoted hunk ↗ jump to hunk
+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-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html