Re: Interacting with a input kernel driver from user space

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

 



On 11/14/2011 06:57 PM, Dmitry Torokhov wrote:
On Monday, November 14, 2011 10:24:17 AM Nuno Santos wrote:
Hi,

I have defined my first attribute in the following way:

static ssize_t usbtouchscreen_update_sensibility(struct device *dev,
                                          struct device_attribute *attr,
                                          const char *buf, size_t count)
{

      printk(KERN_INFO "update sensibility called");

Updating sensibility is always a good thing but I gather you mean
sensitivity here...

hahaahha thanks for the correction!!!! I need to do it in several places now! :)

BTW this should probably be a per-user setting and belong to the X driver,
not kernel driver. I.e. kernel streams all data and userspace (X) decides
what data do discard according to current user preferences.
didn't knew about this capability. but how do you change the settings thru X? where can I find the API for that?

      return 0;
}

static DEVICE_ATTR(sensibility, 0664, NULL,
usbtouchscreen_update_sensibility);

static struct attribute *usbtouchscreen_attrs[] = {
&dev_attr_sensibility.attr,
          NULL
};

static const struct attribute_group usbtouchscreen_attr_group = {
          .attrs = usbtouchscreen_attrs,
};

In the probe function I have added:

if (sysfs_create_group(&intf->dev.kobj,&usbtouchscreen_attr_group))
          goto out_unregister_input;


Then I tried to write on the attribute in the following way:

nsantos@NS-PC:~/workspaces/linux-kernel-driver$ echo 45>
/sys/class/input/input7/sensibility
bash: /sys/class/input/input7/sensibility: No such file or directory

After digging a bit under /sys/class/input/input7 i found that the sub
directory device add sensibilty listed so I tried the following:

nsantos@NS-PC:~/workspaces/workspace-mtt/linux-kernel-driver$ sudo echo
45>  /sys/class/input/input7/device/sensibility
bash: /sys/class/input/input7/device/sensibility: Permission denied

With no success again...

Am I doing something terribly wrong?
You aren't doing this as root and don't have permission to access the
attribute.
sudo doesn't work in this case? Because I was suddoing. if I change the attribute to 777 will it be available to everyone? is this a good way of doing it?


Sorry for all this questions. Is my first linux driver ever!

Thanks,

With my best regards,

Nuno
--
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