最近遇到的问题,虽然网上有些解释,但不是很懂。希望有大神帮忙醍醐灌顶下!
/ * Polled input device provides a skeleton for supporting simple input
* devices that do not raise interrupts but have to be periodically
* scanned or polled to detect changes in their state.
*/
看说明的意思是当没有中断产生时,可以poll一次去读它们的变化状态。
数据结构是:
struct input_polled_dev {
void *private;
void (*open)(struct input_polled_dev *dev);
void (*close)(struct input_polled_dev *dev);
void (*poll)(struct input_polled_dev *dev);
unsigned int poll_interval; /* msec */
unsigned int poll_interval_max; /* msec */
unsigned int poll_interval_min; /* msec */
struct input_dev *input;
/* private: */
struct delayed_work work;
};
看起来input_dev是 input_polled_dev的父类.但脑子里对它们没有很清楚的认识。对于一个输入设备,什么时候我选择input_dev,什么时候我选择 input_polled_dev呢?能否帮忙举一个形象的例子来说明下?
另外hwmon框架是干嘛用的,是不是几乎所有的sensor都偏爱使用此框架?
如果一个设备注册为 hwmon_device_register,它和字符设备有什么差别吗?