libusb并轮询/选择 [英] libusb and poll / select

查看:219
本文介绍了libusb并轮询/选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Linux操作系统,想知道是否有任何我可以轮询/选择的文件描述符,这些描述符会在等待从USB设备读取数据时触发.我也在使用libusb库,还没有找到我可以使用的文件描述符.

I'm using a linux OS and was wondering if there were any file descriptors I could poll/select which would trigger when data was waiting to be read from a usb device. I am also using the libusb library and have yet to find file descriptors which I can use.

推荐答案

使用 libusb的轮询功能将其文件描述符链接到事件循环中.每当libusb需要处理的活动(包括但不限于可读取的数据)时,select就会唤醒.

Use libusb's polling functions to hook its file descriptors into your event loop. select will wake up whenever there's activity that libusb will need to handle, which includes but probably is not limited to data being available for reading.

这篇关于libusb并轮询/选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆