为什么调用python的fcntl.ioctl会给出一个Invalid参数错误

时间:2013-01-31 14:52:16

标签: python python-2.7 fcntl

我正试图以下列方式利用python的fcntl package命令fcntl.ioctl

buf = array.array('h', [0])
fcntl.ioctl(file_handler, 21780)
fcntl.ioctl(file_handler, 21780, buf)
fcntl.ioctl(file_handler, 21780, buf, 1)

即。它的所有三个版本,file_handler使用open创建文件处理程序。每个人都给我同样的错误:

IOError: [Errno 22] Invalid argument

简单问题:如何正确拨打fcntl.ioctl?或者改为使用fcntl.fcntl

1 个答案:

答案 0 :(得分:0)

看起来你正在使用错误的文件。您的示例C代码引用/dev/bus/usb/<bus_id>/<device_id>,而不是/dev/ttyACM0

相关问题