Adding a (USB) driver

I need to add a wireless home automation controller to my OpenSUSE 11.0 laptop (/proc/version says Linux version The controller is a CM19A that connects via USB. (This is an X10 controller.)

I found source code for a driver at Linux HA - Generic USB driver and it includes a module designed for Linux 2.6.

When I try to build the driver, I get “No rule to make target `modules’”. The makefile is essentially running

make -C SUBDIRS=/home/myusername/src/iplc/driver/linux-2.6/cm19a.d modules

This suggests that the method for building drivers on OpenSUSE is a little different from what this Makefile is expecting. The specified modules build directory doesn’t include any Makefile. It holds makedumpfile.config and Module.symvers.

Any ideas?

==== transcript of build attempt follows ====

myusername@gum:~/src/iplc/driver/linux-2.6/cm19a.d> make
make -C /lib/modules/ SUBDIRS=/home/myusername/src/iplc/driver/linux-2.6/cm19a.d modules
make[1]: Entering directory /usr/src/linux-' make[1]: *** No rule to make target modules’. Stop.
make[1]: Leaving directory `/usr/src/linux-’
make: *** [default] Error 2

Try installing the usbdev rpms from yast>software so it can build the usb module.

Thanks for the suggestion, but I’m not finding a “usbdev” package in my YaST2 search.

I see that I’ve got libusb and libusb-devel installed.

The other thing I notice is that when I plug in my CM19A, three entries show up in the /dev pseudodirectory (usbdev3.2_ep00, …ep02, and …ep81). So, something is recognizing the existence of the device. I don’t know enough about how usb stuff works to determine whether this is in any way relevant. Presumably not…

libusb and libusb-devel are the right packages.

As you say, it looks like something is recognised.
I take it you are following the instructions in the link you gave.
In which case, you need to cd to the source directory and run: make all.
(not a programmer, but I dabble a bit)

Thanks. Actually, I *am *a developer – I just haven’t done any development on drivers, nor have I done a lot on OpenSUSE.
The Makefile for this software is is set up to run in the /lib/modules/ directory (that’s the “-C” option), which appears to be missing something.
I have a feeling that libusb is not relevant. I suspect that that what’s missing are files for developing modules that can be installed into or removed from the kernel while it’s running.
Thanks for your attempt to help, but I think I’m still missing the relevant information.

Do you have the kernel-source, linux-kernel-headers, kernel-syms and
module-init-tools installed?

There is also a default template to build rpms in the documentation for
creating a rpm <name>-kmp as well.

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 0:10, 1 user, load average: 0.00, 0.28, 0.32
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.29

Yup, I’ve got kernel-source, linux-kernel-headers, kernel-syms, and module-init-tools installed.

As for building an rpm, I can think about that *after *I figure out how to build a kernel module.

It build fine here, aside from a usb error;


I just unpacked the source and cd’d to the module directory and ran

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 2:06, 2 users, load average: 0.47, 0.24, 0.13
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.29

So, it appears that the standard way to construct a Makefile for a kernel module is to specify that “make” is supposed to temporarily “cd” to
/lib/modules/$(uname -r)/build
using the -C switch. On my OpenSUSE 11.0 system, that works out to
…which is symlinked to…
…which doesn’t really have anything useful in it.
HOWEVER, /usr/src/linux-obj/x86_64/default seems to be the right directory. It appears that somehow, on my system, the “build” subdirectory got symlinked to the wrong place…

Sounds like you now have it working if the links were incorrect? Maybe
somehow the build overwrote something?

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 5:50, 2 users, load average: 0.01, 0.23, 0.31
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.29

No, I’m pretty sure that none of my attempts to build kernel driver modules did anything to mess up the system configuration.

I’d be interested to hear what others find. If you run
uname -r
and then take the output and fill in
/lib/modules/$(uname -r)/build

I’d be very curious to learn what you find in that directory. On my system, that directory expands to
…and contains: makedumpfile.config and Module.symvers

If it had been symlinked properly, it should have contained a lot more stuff, including a Makefile.

In any event, I’m now in biz. The driver is installed and working like a charm.

Here is mine (remember this is 11.1);

ls -la /lib/modules/`uname -r`/build
lrwxrwxrwx 1 root root 42 2009-01-14
14:40 /lib/modules/
-> /usr/src/linux-

ls -la /lib/modules/`uname -r`/build/
total 1080
drwxr-xr-x 7 root root   4096 2009-01-14 14:40 .
drwxr-xr-x 7 root root   4096 2008-12-04 21:45 ..
drwxr-xr-x 3 root root   4096 2009-01-14 14:38 arch
-rw-r--r-- 1 root root  95265 2008-12-04 19:49 .config
drwxr-xr-x 5 root root   4096 2009-01-14 14:38 include
drwxr-xr-x 2 root root   4096 2009-01-14 14:38 include2
drwxr-xr-x 2 root root   4096 2008-12-04 19:49 kernel
-rw-r--r-- 5 root root    514 2008-12-04 19:50 Makefile
-rw-r--r-- 1 root root 406767 2008-12-04 21:46 modules.alias
-rw-r--r-- 1 root root 550612 2008-12-04 21:06 Module.symvers
drwxr-xr-x 6 root root   4096 2009-01-14 14:38 scripts

I wonder if you force the re-install of the kernel-syms it may help.

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 6:24, 2 users, load average: 0.29, 0.31, 0.20
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.29