Can anyone help me build a webcam device driver?
Posted 02-03-2009 at 08:45 AM by mcvasant
I've installed Fedora 6 (kernel 2.6.18-1.2798.fc6) on my Acer Aspire 5570 laptop.
It's got an Acer Orbicam webcam on it.I am trying to build a device driver for it as it does not work on its own in Linux.
I've first tried to build a simple "hello world" module as a driver.
Here are the things I did:
1. Installed kernel-devel-2.6.18-1.2798.fc6.i586 as
yum install kernel-devel-2.6.18-1.2798.fc6.i586
2. Then I gave a command
ln -s /usr/src/kernels/2.6.22.14-72.fc6-i586 /usr/src/linux
3. Wrote a module as hello.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void) {
printk("<1> Hello world!\n");
return 0;
}
static void hello_exit(void) {
printk("<1> Bye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Saved it in /root
4. Saved the same code as hello.o
5. Wrote a "Makefile" as
obj-m := hello.o
6. Issued make command as
[root@localhost ~]# make -C /usr/src/kernels/2.6.22.14-72.fc6-i686 M=$PWD modules
It compiled as
make: Entering directory `/usr/src/kernels/2.6.22.14-72.fc6-i686'
CC [M] /root/hello.o
Building modules, stage 2.
MODPOST 1 modules
CC /root/hello.mod.o
LD [M] /root/hello.ko
make: Leaving directory `/usr/src/kernels/2.6.22.14-72.fc6-i686'
7. Then I loaded hello.ko as
[root@localhost ~]# insmod hello.ko
insmod: error inserting 'hello.ko': -1 Invalid module format
This was the error message that i got.
Now I wanna know if anyone can help me solve this problem and help me build a webcam device driver.
It's got an Acer Orbicam webcam on it.I am trying to build a device driver for it as it does not work on its own in Linux.
I've first tried to build a simple "hello world" module as a driver.
Here are the things I did:
1. Installed kernel-devel-2.6.18-1.2798.fc6.i586 as
yum install kernel-devel-2.6.18-1.2798.fc6.i586
2. Then I gave a command
ln -s /usr/src/kernels/2.6.22.14-72.fc6-i586 /usr/src/linux
3. Wrote a module as hello.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void) {
printk("<1> Hello world!\n");
return 0;
}
static void hello_exit(void) {
printk("<1> Bye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Saved it in /root
4. Saved the same code as hello.o
5. Wrote a "Makefile" as
obj-m := hello.o
6. Issued make command as
[root@localhost ~]# make -C /usr/src/kernels/2.6.22.14-72.fc6-i686 M=$PWD modules
It compiled as
make: Entering directory `/usr/src/kernels/2.6.22.14-72.fc6-i686'
CC [M] /root/hello.o
Building modules, stage 2.
MODPOST 1 modules
CC /root/hello.mod.o
LD [M] /root/hello.ko
make: Leaving directory `/usr/src/kernels/2.6.22.14-72.fc6-i686'
7. Then I loaded hello.ko as
[root@localhost ~]# insmod hello.ko
insmod: error inserting 'hello.ko': -1 Invalid module format
This was the error message that i got.
Now I wanna know if anyone can help me solve this problem and help me build a webcam device driver.
Total Comments 0