因此,我正在尝试修改evdev.c,它是用于Linux等鼠标等输入设备的事件处理程序驱动程序。

我遇到的问题是,当我尝试编译模块时,出现大量错误,提示找不到evdev的成员。

/home/mousedev_dbl.c:215: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c:216: error: ‘struct evdev’ has no member named ‘client_list’
/hom/mousedev_dbl.c:217: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c: In function ‘evdev_detach_client’:
/home/mousedev_dbl.c:224: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c:226: error: ‘struct evdev’ has no member named ‘client_lock’
/home/mousedev_dbl.c: In function ‘evdev_open_device’:
/home/mousedev_dbl.c:234: error: ‘struct evdev’ has no member named ‘mutex’
/home/mousedev_dbl.c:238: error: ‘struct evdev’ has no member named ‘exist’


这只是错误的一小部分。

evdev的结构显然存在于我正在编译的mousedev_dbl.c文件中。

struct evdev {
      int open;
      int minor;
      struct input_handle handle;
      wait_queue_head_t wait;
      struct evdev_client __rcu *grab;
      struct list_head client_list;
      spinlock_t client_lock; /* protects client_list */
      struct mutex mutex;
      struct device dev;
      bool exist;
};


例如,下面是第215行的用法。

spin_lock(&evdev->client_lock);
list_add_tail_rcu(&client->node, &evdev->client_list);
spin_unlock(&evdev->client_lock);
synchronize_rcu();


什么会导致这些错误?整个文件可以在这里找到:
http://lxr.free-electrons.com/source/drivers/input/evdev.c

最佳答案

struct evdev_client __rcu *grab;


该声明有效吗? (在我看来不是,除非__rcu用于预处理器)。

似乎此声明使您的struct evdev其余部分显示为乱码。这可能解释了编译器无法识别client_listclient_lock等。

10-06 15:07