作者greenlinux (GreenLinux)
看板LinuxDev
标题[问题] 请教如何让driver收到多个参数
时间Wed Jan 21 18:55:25 2015
请教各位:
我在driver里有建立 device_attribute
所以可以利用 echo xx > driver 让 driver收到参数.
但这种方法只能收到 1 个参数.
请问要怎样才能收到多个参数??
谢谢各位..
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 223.137.240.79
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/LinuxDev/M.1421837728.A.D1C.html
1F:推 clanguage: echo "1 2 3" > driver 01/21 22:16
2F:→ greenlinux: 请问C大. 我该怎样接那3参数: 01/22 09:50
3F:→ greenlinux: static ssize_t test(struct device *dev, 01/22 09:50
4F:→ greenlinux: struct device_attribute *attr, 01/22 09:51
5F:→ greenlinux: const char *buf, 01/22 09:51
6F:→ greenlinux: size_t count) 01/22 09:52
7F:→ greenlinux: 在 buf, 後面新增一个 char *buf2 吗? THANKS 01/22 09:52
8F:→ greenlinux: 我只能用sscanf(buf,"%x",tmp)将1个data收进tmp里 01/22 10:02
9F:→ greenlinux: 谢谢;可以用sscanf(buf,"%x:%x",&t[0],t[1]..)来收 01/22 10:47
10F:→ greenlinux: 真抱歉, 忘了sscanf 的特性... 01/22 10:59