看板 LinuxDev 關於我們 聯絡資訊
請教各位: 我在driver裡有建立 device_attribute 所以可以利用 echo xx > driver 讓 driver收到參數. 但這種方法只能收到 1 個參數. 請問要怎樣才能收到多個參數?? 謝謝各位.. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.137.240.79 ※ 文章網址: https://www.ptt.cc/bbs/LinuxDev/M.1421837728.A.D1C.html
clanguage: echo "1 2 3" > driver 01/21 22:16
greenlinux: 請問C大. 我該怎樣接那3參數: 01/22 09:50
greenlinux: static ssize_t test(struct device *dev, 01/22 09:50
greenlinux: struct device_attribute *attr, 01/22 09:51
greenlinux: const char *buf, 01/22 09:51
greenlinux: size_t count) 01/22 09:52
greenlinux: 在 buf, 後面新增一個 char *buf2 嗎? THANKS 01/22 09:52
greenlinux: 我只能用sscanf(buf,"%x",tmp)將1個data收進tmp裡 01/22 10:02
greenlinux: 謝謝;可以用sscanf(buf,"%x:%x",&t[0],t[1]..)來收 01/22 10:47
greenlinux: 真抱歉, 忘了sscanf 的特性... 01/22 10:59