简体   繁体   English

错误:未声明“ usb_serial_probe”,设备驱动程序中的linux 3.10

[英]error: ‘usb_serial_probe’ undeclared, linux 3.10 in device driver

I am trying to compile a Linux drived for USB-to-Serial device and getting error 我正在尝试为USB转串口设备编译Linux驱动器并出现错误

 /root/moxa_usb_to_serial/mxu11x0/driver/mxu11x0.c:307: error: ‘usb_serial_probe’ undeclared here (not in a function)
 /root/moxa_usb_to_serial/mxu11x0/driver/mxu11x0.c:308: error: ‘usb_serial_disconnect’ undeclared here (not in a function)

I have linux 我有Linux

 Linux host 3.10.33-rt32.34.el6rt.x86_64 #1 SMP PREEMPT RT Wed May 28 09:57:12 CEST 2014 x86_64 x86_64 x86_64 GNU/Linux

The manufacturer of driver actually warns that above 3.4 driver might not be compartible. 驱动程序制造商实际上警告说,高于3.4的驱动程序可能不兼容。 However driver itself is rather small and I believe I can make some trivial fixes. 但是驱动程序本身很小,我相信我可以进行一些小改进。 How this can be solved? 如何解决?

The manufacturer of driver actually warns that above 3.4 driver might not be compartible. 驱动程序制造商实际上警告说,高于3.4的驱动程序可能不兼容。

A quick check of one symbol indicates that this aspect of the kernel USB serial interface has changed. 快速检查一个符号表示内核USB串行接口的这一方面已更改。 In 3.10 usb_serial_probe() was made static (see its 3.10 cross reference ), so it's no longer part of the kernel USB interface. 在3.10版中, usb_serial_probe()被设置为静态(请参见其3.10交叉引用 ),因此它不再是内核USB接口的一部分。 There's no need to go looking for the "proper" header file to include. 无需去寻找要包含的“适当”头文件。
Your presumption about making "some trivial fixes" may be hasty. 您对进行“一些琐碎的修补程序”的推定可能很仓促。

You need to get the 3.4 Linux source tree and find examples of the USB serial interface. 您需要获取3.4 Linux源代码树并找到USB串行接口的示例。
Here's a list of the 3.4 drivers that use usb_serial_probe() . 这是使用usb_serial_probe()的3.4驱动程序的列表
You need to find a 3.4 driver that resembles the driver that you're trying to port, eg uses usb_serial_probe() and usb_serial_disconnect() such as usb/serial/generic.c . 您需要找到一个与您要移植的驱动程序相似的3.4驱动程序,例如使用usb_serial_probe()usb_serial_disconnect(),例如usb / serial / generic.c
Then find that version of the driver in the 3.10 source, and see how that driver has evolved since 3.4 (use diff or sdiff ). 然后在3.10源代码中找到该驱动程序的版本,并查看该驱动程序自3.4版以来的发展情况(使用diffsdiff )。
Those changes will be a guide to what has to be modified in your driver. 这些更改将指导您在驱动程序中进行哪些更改。

I have that symbols defined in a file called usb-serial.h, in a driver for quite another interface. 我在另一个接口的驱动程序中的名为usb-serial.h的文件中定义了这些符号。 But it gives me the impression you are not including the right header files for the compilation of your driver. 但这给我的印象是您没有包括用于驱动程序编译的正确头文件。

So, I'd suggest you do a search in all .h files in your driver directory, and look for a function called usb_serial_probe. 因此,建议您在驱动程序目录中的所有.h文件中进行搜索,然后寻找一个名为usb_serial_probe的函数。 If you find it, check if you are correctly adding the file in your compile command. 如果找到它,请检查是否在编译命令中正确添加了文件。

Are you using a manufacturer-provided Makefile? 您使用的是制造商提供的Makefile吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM