ftd2型xx.打开始终创建设备状态FT_INVALID_句柄

2024-09-27 09:21:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在Ubuntu中使用ftd2xx库。但当我想打开设备时,收到的状态总是“无效的”句柄。
在我尝试使用python之前,我用C编写了一个运行良好的程序。作为两个程序的库,我使用libftd2xx.所以.1.3.6条。在

import ftd2xx as ft

g = ft.open(0)
g.status

>> 1  #FT_INVALID_HANDLE

为什么设备状态总是无效的句柄?在


Tags: import程序ubuntu状态asstatusopen句柄
1条回答
网友
1楼 · 发布于 2024-09-27 09:21:52

状态在类中声明为1。status只告诉您设备是用1打开还是没有用0打开。在

class FTD2XX(object):
    """Class for communicating with an FTDI device"""
    def __init__(self, handle, update=True):
        """Create an instance of the FTD2XX class with the given device handle
        and populate the device info in the instance dictionary. Set
        update to False to avoid a slow call to createDeviceInfoList."""
        self.handle = handle
        self.status = 1
        # createDeviceInfoList is slow, only run if update is True
        if update: createDeviceInfoList()
        self.__dict__.update(self.getDeviceInfo())

相关问题 更多 >

    热门问题