Can the sysfs attributes accepts the data in a string form …
是.
实际上这就是sysfs在使用echo时所接受的内容.当您使用echo 0时,输出是两个字节,0x30(数字零的ASCII码)和0x0A(换行符).
例如,GPIO LED接口使用关键字来报告和选择触发器.
# cat /sys/class/leds/d8/trigger
none nand-disk mmc0 timer [heartbeat] gpio
(括号中的关键字表示当前选择,即心跳计时器.)
# echo none > /sys/class/leds/d8/trigger
# cat /sys/class/leds/d8/trigger
[none] nand-disk mmc0 timer heartbeat gpio
… (something like echo "somedata" > sysfs_interface )
您甚至不需要使用引号.
请参阅上面将LED触发器设置为无的示例.
附录
these are the custom interfaces …
不,这是主线.
… but what about the one provided by the subsystem?
Attributes should be ASCII text files,preferably with only one value
per file.