2

I am new to kernel programming and I have dev_t value of a USB device.

I want to get the details of the device like vendor ID, product ID, or some other attribute which will vary from device to device. I want to do this in kernel space, and without loading my program as an external module.

I have came across a libusb library, however, as far as I know, it is used in user space. Is it possible to use libusb in kernel space also, like my requirement? If possible, how to import and set-up libusb so that I can compile kernel?

4

1 回答 1

1

最好为此任务编写一个可加载的内核模块。每次你发现一个错误,你只需要针对你的内核编译你的模块并加载它。内核中有一个为 USB 定义的框架,使用内核提供的 API 来做你正在寻找的事情。除了 libusb 是一个用户空间库,在内核中使用它没有意义。在用户空间中,您也可以使用 procfs/sysfs 访问 USB 相关信息。

于 2013-03-07T08:27:03.523 回答