0

Is it possible to write more than one character (say like a whole string to the driver sysfs interface from the user application) e.g I have input class subsystem driver , whose get_command sysfs I have defined as one of the attribute and can see in the /sys/class/input/my_driver/ Can I send a string of command - "09288011" pattern to it via user application.Generally we do echo X > get_command at the command bash level but how can we write a pattern to the sysfs?

is there any special name for this?

Syfs creation is done by this :

static DEVICE_ATTR(my_sysfs, 0666, my_driver_show, my_driver_store);

both store and save are like this : 


static ssize_t my_driver_XX(struct device *dev,
                  struct device_attribute *attr,
                  const char *buff, size_t count)
Raulp
  • 7,758
  • 20
  • 93
  • 155
  • Which way do you use for create files under sysfs? If creation function accepts (directly or indirectly) argument of type `struct kobj_attribute`, then its `.store` method has access to all characters written to the file, so you may implement any logic for processing input. – Tsyvarev Aug 11 '16 at 18:00
  • I have updated the Question with the way I am creating the sysfs .Can you please point to the documentation for this or any link/blog? – Raulp Aug 12 '16 at 06:01
  • 1
    ok i got the answer from this post : http://stackoverflow.com/questions/23280635/create-sysfs-entry-from-kernel-module I have added some of my comments to prevent the build error which you may get on compiling the module. – Raulp Aug 12 '16 at 06:54

0 Answers0