Re: Interacting with a input kernel driver from user space

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

 



Hi Nuno,

On Wed, Nov 16, 2011 at 05:28:13PM +0000, Nuno Santos wrote:
>     Why? I thought this thing is an input device? Why does an
> application have to modify a running device? Is this modification
> local to the application<->device interface or does it also affect
> all other running applications that use this device? If it is a
> configuration value to put the device into a different state or
> similar, then you can use a sysfs attribute. The user can change
> this with "echo <value> >/sys/class/input/inputX/<attribute>"

Any chance you could use some sane quoting style? It is almost
impossible to dechipher where someone else's mail stops and your reply
starts.

> 
> I'm already with working examples of ATTRIB in my driver project.
> The thing is that I have random kernel panics when I try to read
> from the attribute. This is my attribute code:
> 
> static ssize_t usbtouchscreen_get_state(struct device *dev, struct
> device_attribute *attr, char *buf)
> {
>     int count=0;
>     struct usbtouch_usb *usbtouch = dev_get_drvdata(dev);
>     struct dpx_priv *priv = usbtouch->priv;
> 
>     printk(KERN_INFO "state length: %d",sizeof(DPX_DEVICE_STATE));
> // size = 43196 bytes

So it is probably 39K more than sysfs attribute can handle.

> 
>     memcpy(buf,(void*)&priv->context->State,sizeof(DPX_DEVICE_STATE));

and you are smashing kernel stack here.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" 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 Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux