diff options
Diffstat (limited to 'test/write_attr_2.c')
-rw-r--r-- | test/write_attr_2.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/write_attr_2.c b/test/write_attr_2.c new file mode 100644 index 0000000..6c895c2 --- /dev/null +++ b/test/write_attr_2.c @@ -0,0 +1,27 @@ +/* write attribute support for the given device */ + +#include <stdio.h> + +#include "libsysfs.h" + +int main(int argc, char *argv[]) +{ + /* + * need args: device, attribute and value to be changed to + * eg: ./fn_name <device> <attribut> <val to change to> + */ + if (argc != 4) { + fprintf(stdout, "Need 4 args\n"); + return 1; + } +/* if ((sysfs_change_attribute_value(argv[1], argv[2], argv[3])) < 0) {*/ + if ((sysfs_write_device_attr(argv[1], argv[2], argv[3])) < 0) { +/* if ((sysfs_write_classdev_attr(argv[1], argv[2], argv[3])) < 0) {*/ +/* if ((sysfs_write_driver_attr(argv[1], argv[2], argv[3])) < 0) {*/ + fprintf(stdout, "Write attribute error\n"); + return 1; + } + fprintf(stdout, "Write succeeded\n"); + return 0; +} + |