clinuxdriversevdev

Linux module compiling: struct evdev member not found


So, I am trying to modify evdev.c, which is an event handler driver for input devices like mouse on linux.

The problem I am having is that when I try to compile the module, I get a ton of errors saying the members of evdev cannot be found.

/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’

This is only a small portion of the errors.

The struct for evdev is clearly present in the mousedev_dbl.c files I am compiling.

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;
};

As an example, here is how it is used on line 215.

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

What would cause these errors?? The entire file can be found here: http://lxr.free-electrons.com/source/drivers/input/evdev.c


Solution

  • The problem was that I was using the kernel source from the wrong version. 2.6.38 rather than 2.6.35 so the headers and the source were not mixing well.