def getPollFDList(self):
"""
Return file descriptors to be used to poll USB events.
You should not have to call this method, unless you are integrating
this class with a polling mechanism.
"""
pollfd_p_p = libusb1.libusb_get_pollfds(self.__context_p)
if not pollfd_p_p:
errno = get_errno()
if errno:
raise OSError(errno)
else:
# Assume not implemented
raise NotImplementedError(
'Your libusb does not seem to implement pollable FDs')
try:
result = []
append = result.append
fd_index = 0
while pollfd_p_p[fd_index]:
append((
pollfd_p_p[fd_index].contents.fd,
pollfd_p_p[fd_index].contents.events,
))
fd_index += 1
finally:
_free(pollfd_p_p)
return result
评论列表
文章目录