[問題] 請教如何讓driver收到多個參數

作者: greenlinux (GreenLinux)   2015-01-21 18:55:25
請教各位:
我在driver裡有建立 device_attribute
所以可以利用 echo xx > driver 讓 driver收到參數.
但這種方法只能收到 1 個參數.
請問要怎樣才能收到多個參數??
謝謝各位..
作者: clanguage (C語言)   2015-01-21 22:16:00
echo "1 2 3" > driver
作者: greenlinux (GreenLinux)   2015-01-22 09:50:00
請問C大. 我該怎樣接那3參數:static ssize_t test(struct device *dev,struct device_attribute *attr,const char *buf,size_t count)在 buf, 後面新增一個 char *buf2 嗎? THANKS我只能用sscanf(buf,"%x",tmp)將1個data收進tmp裡謝謝;可以用sscanf(buf,"%x:%x",&t[0],t[1]..)來收真抱歉, 忘了sscanf 的特性...

Links booklink

Contact Us: admin [ a t ] ucptt.com