From: bsl04@... (Brian) Date: 2002-11-09T14:17:08+09:00 Subject: ioctl to detect CTS I'm trying to convert some working C that watches a serial port for CTS to go high, at which point it does some stuff. It watches for CTS by doing .... ioctl(fd, TIOCMGET, &s); if ((s & TIOCM_CTS) == TIOCM_CTS) { .... I tried to reimplement this in ruby with stuff like f = File.open '/dev/modem' p f.ioctl(0x5415) but it results in errors. irb(main):006:0> f.ioctl(0x5415) Errno::EFAULT: Bad address - "/dev/modem" from (irb):6:in `ioctl' from (irb):6 So I wrote something to brute out the ioctls that didn't raise an exception, and tried them all, but I never seem to get anything sane. Please give me a clue what's wrong.