我正在为Ubuntu 10.04(内核2.6.32.52)上的USB显示器构建设备驱动程序。根据制造商的说法,系统必须有Git,Linux Headers,GCC,Binutils和Make。我检查了所有这些事情。然后我从制造商的github网站下载了驱动程序源代码,我cd到驱动程序目录并运行make,但是有一些错误和警告:
make -C /lib/modules/`uname -r`/build KCPPFLAGS="-I/home/someuser/rpusbdisp/drivers/linux-driver/src -I/home/someuser/rpusbdisp/drivers/linux-driver/../common" M=/home/someuser/rpusbdisp/drivers/linux-driver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-52-generic'
Makefile:597: "WARNING: Appending $KCPPFLAGS (-I/home/someuser/rpusbdisp/drivers/linux-driver/src -I/home/someuser/rpusbdisp/drivers/linux-driver/../common) from command line to kernel $CPPFLAGS"
CC [M] /home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.o
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c: In function ‘_status_start_querying’:
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c:300: error: implicit declaration of function ‘usb_pipe_endpoint’
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c:300: warning: assignment makes pointer from integer without a cast
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c: In function ‘_on_release_disp_tickets_pool’:
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c:866: error: implicit declaration of function ‘usb_free_coherent’
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c: In function ‘_on_alloc_disp_tickets_pool’:
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c:905: error: implicit declaration of function ‘usb_alloc_coherent’
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c:905: warning: assignment makes pointer from integer without a cast
/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.c:936: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 5 has type ‘size_t’
make[2]: *** [/home/someuser/rpusbdisp/drivers/linux-driver/src/usbhandlers.o] Error 1
make[1]: *** [_module_/home/someuser/rpusbdisp/drivers/linux-driver] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-52-generic'
make: *** [modules] Error 2
我希望有人可以提供一些指导,我应该检查哪些包,或者是否有替代'usb_pipe_endpoint'和'usb_alloc_coherent'的替代功能。
感谢。
所以我改变了usb_alloc_coherent与usb_buffer_alloc和usb_free_coherent与usb_buffer_free。它解决了三个错误中的两个。
答案 0 :(得分:0)
你也安装了libusb吗?
如果没有,请安装sudo apt-get install libusb-dev
,然后再次尝试make clean
和make
。
只需添加,将您对这些文件所做的更改还原为在usb.h(在libusb中)中声明的文件。
git reset --hard
如果您使用git克隆它。
注意:这将重置所有未提交的git更改!