From owner-freebsd-hackers Sun Sep 30 18:14:27 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.shell-server.com (24-109-11-245.ivideon.com [24.109.11.245]) by hub.freebsd.org (Postfix) with SMTP id 7BBCA37B411 for ; Sun, 30 Sep 2001 18:14:21 -0700 (PDT) Received: (qmail 15005 invoked from network); 1 Oct 2001 01:14:19 -0000 Received: from betsy.shell-server.com (HELO there) (192.168.3.2) by erin-rl0.shell-server.com with SMTP; 1 Oct 2001 01:14:19 -0000 From: Bart Kus Message-Id: <200109301623.4359@EO> To: Mike Meyer Subject: Re: sio modification Date: Sun, 30 Sep 2001 20:15:27 -0500 X-Mailer: KMail [version 1.3] Cc: hackers@freebsd.org References: <200109301003.06903@EO> <15287.29386.998663.37631@guru.mired.org> In-Reply-To: <15287.29386.998663.37631@guru.mired.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_R56ITYN8AH69ZPC1022E" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --------------Boundary-00=_R56ITYN8AH69ZPC1022E Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit On Sunday 30 September 2001 14:30, Mike Meyer wrote: > It looks like you've already got a solution to this problem, and this > won't be very useful if the 40kHz figure is right, but I figured I > might mention it anyway. Have you thought about using the feature of > the callin device of the "open" call blocking until it gets CD? You > should then get a SIGHUP when CD drops. This sounded like a really good idea when I first read it, so I wrote a test. The first thing I noticed is that SIGHUP was *NOT* being generated (any idea why?) on CD transition to low. I then realized that I could use write() and it would fail when CD==low. So I used that technique for detecting CD==low, and after setting "dtrwait" to 0 using comcontrol, things seemed to be going well. However, I pressed the same button on the remote multiple times and I noticed a very high variance in the time-deltas between high/low states. In fact, sometimes 7 transitions are reported, sometimes 9. The variance for some time-deltas is sometimes as high as a factor of 10 (note: I'm not using the statistical definition of variance - I simply mean that a +edge -> -edge time can be 100us and then 1000us on the next press of the same button). Sadly, this seemingly good mechanism doesn't perform well enough to produce the kind of data I'd need for pattern matching. Perhaps actually managing to generate a SIGHUP would cut down on this variance? I've attached the source for the test program for your reading enjoyment. :) Don't feel obligated to open it. --Bart --------------Boundary-00=_R56ITYN8AH69ZPC1022E Content-Type: text/x-c; charset="iso-8859-1"; name="IRBaboon2.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="IRBaboon2.c" LyogQ293ICYgQ2hpY2tlbiBydWxlIQogKgogKiBJUkJhYm9vbiBDb3B5cmlnaHQgKEMpIEJhcnQg S3VzLCAyMDAxLgogKi8KCi8qIE5PVEU6CiAqIEJlIFNVUkUgdG8gZG8gYTogY29tY29udHJvbCAv ZGV2L2lyYmFib29uIGR0cndhaXQgMAogKiBQcmlvciB0byBydW5uaW5nIHRoaXMgcHJvZ3JhbSEK ICovCgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPGZjbnRsLmg+CiNpbmNsdWRlIDx0ZXJt aW9zLmg+CiNpbmNsdWRlIDxzaWduYWwuaD4KI2luY2x1ZGUgPHN5cy90aW1lLmg+CiNpbmNsdWRl IDxzeXMvdHlwZXMuaD4KI2luY2x1ZGUgPHN5cy91aW8uaD4KI2luY2x1ZGUgPHVuaXN0ZC5oPgoK aW50IGk7CnVuc2lnbmVkIGludCBkdFsyNTZdOwoKdm9pZCBoYW5kbGVyX3NpZ2h1cChpbnQgZGF0 YSkgewoJcHJpbnRmKCJHb3QgU0lHSFVQXG4iKTsKCglyZXR1cm47Cn0KCnZvaWQgaGFuZGxlcl9z aWdpbnQoaW50IGRhdGEpIHsKCWludCBpMjsKCglmb3IoaTI9MDsgaTIgPCBpOyBpMisrKQoJCXBy aW50ZigiRFQ6ICUwMTBkdXNcbiIsIGR0W2kyXSk7CgoJcmV0dXJuOwp9CgppbnQgbWFpbihpbnQg YXJnYywgY2hhciAqKmFyZ3YpCnsKCWludCBmZDsKCXN0cnV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KGxvdy50dl9zZWMtaGlnaC50dl9zZWMpKjEwMDAw MDAgKyAobG93LnR2X3VzZWMgLSBoaWdoLnR2X3VzZWMpKTsqLwoJCWR0W2krK10gPSAobG93LnR2 X3NlYy1oaWdoLnR2X3NlYykqMTAwMDAwMCArIChsb3cudHZfdXNlYyAtIGhpZ2gudHZfdXNlYyk7 Cgl9CgoJcmV0dXJuIDA7Cn0K --------------Boundary-00=_R56ITYN8AH69ZPC1022E-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message