这真的只是为了满足我对this的好奇心问题。虽然我现在使用替代解决方案,但最初的问题似乎归结为未实现 TIOCMGET 这一事实,我想了解一下为什么会这样。
遗憾的是,我没有通过谷歌搜索找到太多有用的信息,而且我发现 tty_ioctl 手册页(第一个结果)非常难以理解。
那么,TIOCMGET 到底是什么,它是在哪里实现的,mono 可能在哪里寻找它却找不到它?
它在 drivers/tty/tty_io.c
中实现,其实现如下:
/**
* tty_tiocmget - get modem status
* @tty: tty device
* @file: user file pointer
* @p: pointer to result
*
* Obtain the modem status bits from the tty driver if the feature
* is supported. Return -EINVAL if it is not available.
*
* Locking: none (up to the driver)
*/
static int tty_tiocmget(struct tty_struct *tty, int __user *p)
{
int retval = -EINVAL;
if (tty->ops->tiocmget) {
retval = tty->ops->tiocmget(tty);
if (retval >= 0)
retval = put_user(retval, p);
}
return retval;
}
正如您将从评论和代码中注意到的,它仅在底层终端驱动程序支持它时才有效,否则将返回 EINVAL
。
有很多驱动支持它,比如isdn4linux
和各种GSM调制解调器驱动,但是普通终端不支持,因为它们不是调制解调器。
我是一名优秀的程序员,十分优秀!