Tuesday, 15 September 2015

c - makefile for a libusb program -


I created the C program through libusb and I'm using the following command to compile it: / P>

  gcc-o usbtst.o usbtst.cnlusb-1.0  

The program is working properly. After this, I added the code of "usbtest.c" to the kernel module (usbmod.c) and I am connected to the make file. I'm not sure what command I should give in the "All" section here what I have done here:

obj-m: = usbmod.o KERNEL_DIR = / lib / module / $ (shell One-R) / PWD = $ (Shell PWD) Build All: $ (Make) -C $ (Kernel DIR) Clear the SUBDIRS = $ (PWD) module: rm -rf * .o * .ko * .mod * * .symvers * .order * -

After running, I am getting the following error:

  experience @ nwv-insiron-3421: ~ / Desktop / USB make make -C /lib/modules/3.13.0- 46 -Genetic / Build SUBDIRS = / home / anubhav / Desktop / usb module [1]: Directory `/ usr / src / linux-headers- 3.13.0-46-generic 'cc [m] / home / disclosure / desktop / usb / usbmod.o/home/anubhav/Desktop/usb/usbmod.c:3:19: fatal error: stdio.h: such a File or directory # include & lt; Stdio.h & gt; ^ Compilation finished making [2]: *** [/home/anubhav/Desktop/usb/usbmod.o] Making error 1 [1]: *** [_module_ / home / anubhav / desktop / usb] Making error 2 [ 1]: Excluding the directory `/usr/src/linux-headers-3.13.0-46-generic ': *** [All] Error 2  

Not sure if any Need to bring the header file to my working directory or please provide suggestions.

OK, so this link clarifies my suspicion to some extent:

< P> [] [1]

This says "stdio.h" and not all kernels are present in space and therefore such errors occur. Apart from this, there is clearly no printf in my module, so I think I do not need "stdio.h".

But it uses libusb extensively. Therefore, there is actually a way to create this module.


No comments:

Post a Comment