Re: New input driver for eBeam device (ask for review)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 22, 2012 at 05:28:12PM +0200, Yann Cantin wrote:
> /*******************************************************************************
>  * sysfs part
>  */
> 
> /*
>  * screen min/max and H matrix coefs
>  * _get return *current* value
>  * _set set new value
>  */
> #define DEVICE_MINMAX_ATTR(MM)                                                 \
> static ssize_t ebeam_##MM##_get(struct device *dev,                            \
>                                 struct device_attribute *attr,                 \
>                                 char *buf)                                     \
> {                                                                              \
>         struct ebeam_device *ebeam = dev_get_drvdata(dev);                     \
>                                                                                \
>         return snprintf(buf, PAGE_SIZE, "%d\n", ebeam->cursetting.MM);         \
> }                                                                              \
> static ssize_t ebeam_##MM##_set(struct device *dev,                            \
>                                 struct device_attribute *attr,                 \
>                                 const char *buf,                               \
>                                 size_t count)                                  \
> {                                                                              \
>         struct ebeam_device *ebeam = dev_get_drvdata(dev);                     \
>         int err, MM;                                                           \
>                                                                                \
>         err = kstrtoint(buf, 10, &MM);                                         \
>         if (err)                                                               \
>                 return err;                                                    \
>                                                                                \
>         ebeam->newsetting.MM = MM;                                             \
>         return count;                                                          \
> }                                                                              \
> static DEVICE_ATTR(MM, S_IRUGO | S_IWUGO,                                      \
>                    ebeam_##MM##_get,                                           \
>                    ebeam_##MM##_set)
> 
> DEVICE_MINMAX_ATTR(min_x);
> DEVICE_MINMAX_ATTR(max_x);
> DEVICE_MINMAX_ATTR(min_y);
> DEVICE_MINMAX_ATTR(max_y);

What are all of these custom sysfs files for?  Are they needed?  Who
reads them?  Shouldn't all of this be handled through the input layer
instead?

You should also post this on the linux-input mailing list, the
developers there can help you out with how it should be integrated into
that subsystem.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux