AnsweredAssumed Answered

Help with linux 2.6.21 kernel module for ADXL345

Question asked by Spfed on Apr 17, 2013
Latest reply on Apr 22, 2013 by Spfed

Hi everyone,

 

I'm working on a project using the ADXL345 with a verdex gumstix running a linux 2.6.21 kernel (old hard and software I know but it was chosen by the course not me). When I try to compile the drivers provided by analog devices ( http://wiki.analog.com/resources/tools-software/linux-drivers/input-misc/adxl345 ) I get the following errors:

 

drivers/input/misc/adxl34x-i2c.c: In function 'adxl34x_disable':

drivers/input/misc/adxl34x-i2c.c:391: warning: implicit declaration of function 'cancel_work_sync'

drivers/input/misc/adxl34x-i2c.c: In function 'adxl34x_disable_store':

drivers/input/misc/adxl34x-i2c.c:430: warning: implicit declaration of function 'strict_strtoul'

drivers/input/misc/adxl34x-i2c.c: In function 'adxl34x_input_open':

drivers/input/misc/adxl34x-i2c.c:633: warning: implicit declaration of function 'input_get_drvdata'

drivers/input/misc/adxl34x-i2c.c:633: warning: initialization makes pointer from integer without a cast

drivers/input/misc/adxl34x-i2c.c: In function 'adxl34x_input_close':

drivers/input/misc/adxl34x-i2c.c:646: warning: initialization makes pointer from integer without a cast

drivers/input/misc/adxl34x-i2c.c: In function 'adxl34x_probe':

drivers/input/misc/adxl34x-i2c.c:714: warning: implicit declaration of function 'dev_name'

drivers/input/misc/adxl34x-i2c.c:714: warning: format '%s' expects type 'char *', but argument 4 has type 'int'

drivers/input/misc/adxl34x-i2c.c:714: warning: format '%s' expects type 'char *', but argument 4 has type 'int'

drivers/input/misc/adxl34x-i2c.c:723: warning: implicit declaration of function 'input_set_drvdata'

drivers/input/misc/adxl34x-i2c.c:779: warning: passing argument 4 of 'request_irq' makes pointer from integer without a cast

...

WARNING: "input_set_drvdata" [drivers/input/misc/adxl34x-i2c.ko] undefined!

WARNING: "dev_name" [drivers/input/misc/adxl34x-i2c.ko] undefined!

WARNING: "strict_strtoul" [drivers/input/misc/adxl34x-i2c.ko] undefined!

WARNING: "cancel_work_sync" [drivers/input/misc/adxl34x-i2c.ko] undefined!

WARNING: "input_get_drvdata" [drivers/input/misc/adxl34x-i2c.ko] undefined!

 

These errors are of course because I am using an outdated version of linux but I was wondering if there is a good tutorial for writing a far simpler kernel module than the one I attempted to compile above using only a few of the chip's functions. I have only limited experience writing kernel modules for linux (e.g., getting PWM working, making basic LED counters, timers, interrupts etc) and know virtually nothing about registering and instantiating I2C devices.

 

Otherwise I am writing a user level program based on the code here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=12503

but I would prefer to have the ability to write a simple kernel module.

 

Thanks in advance

Spfed/Alex

Outcomes