在 USB 设备内部调用 USB 批量发送消息时出现问题 Linux 内核模块
我有一个处理 USB 设备的内核模块。
碰巧我可以成功向设备发送 USB 批量消息,但该操作是在二进制属性的回调下进行的。
然而,当有事情发生时,我需要执行一个特定的操作。发生这种情况时,我需要向设备发送批量消息。发生的地方是自己的设备数据收入回调。如果我在那个地方发送批量消息,我会遇到内核恐慌。
有人能告诉我为什么吗?
如果那不是进行此类操作的适当地点,我可以在哪里安全地进行此操作?我如何发出信号让该操作在另一个地方完成?计时器?
请就这个具体问题提出建议。
I have a kernel module in which I deal with USB devices.
It happens that I can successfully send a USB bulk message to a device, but that operation is being made under the callback of a binary attribute.
However, there is a specific operation that I need to do when something happens. When that happens, I need to send a bulk message to the device. The place in which that occurs is the own device data income callback. If I send the bulk message in that place I get a kernel panic.
Can someone tell me why?
If that is not a proper place to do such operation, where can I safely do it? How can I signal the operation to be done in another place? A Timer?
Please advice regarding this specific problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设法通过以下方法解决了我面临的问题:
我认为这种方法会带来更好的设计,因为花在中断处理上的时间因此减少了。
我现在可以平静地调用
usb_bulk_msg(...)
,因为我不再处于中断上下文中。这确实是问题所在。I managed to solve the problem I was facing with the following approach:
I think this approach leads to a better design since the time spent in the interruption handle is thus reduced.
I can now invoke
usb_bulk_msg(...)
peacefully since I'm not in an interrupt context anymore. That was indeed the problem.