From owner-freebsd-bugs@FreeBSD.ORG Sun Oct 22 12:00:34 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5568A16A403 for ; Sun, 22 Oct 2006 12:00:34 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D131C43D53 for ; Sun, 22 Oct 2006 12:00:33 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9MC0XxI099364 for ; Sun, 22 Oct 2006 12:00:33 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9MC0XLf099361; Sun, 22 Oct 2006 12:00:33 GMT (envelope-from gnats) Resent-Date: Sun, 22 Oct 2006 12:00:33 GMT Resent-Message-Id: <200610221200.k9MC0XLf099361@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Jukka A. Ukkonen" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1719716A6D8 for ; Sun, 22 Oct 2006 11:53:58 +0000 (UTC) (envelope-from jau@jau.iki.fi) Received: from jau.iki.fi (ip193-64-26-117.cust.eunet.fi [193.64.26.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 995A644489 for ; Sun, 22 Oct 2006 11:31:56 +0000 (GMT) (envelope-from jau@jau.iki.fi) Received: from jau.iki.fi (localhost [127.0.0.1]) by jau.iki.fi (8.13.8/8.13.8) with ESMTP id k9MBVsEL037937 for ; Sun, 22 Oct 2006 14:31:54 +0300 (EEST) (envelope-from jau@jau.iki.fi) Received: (from jau@localhost) by jau.iki.fi (8.13.8/8.13.8/Submit) id k9MBVrKa037929; Sun, 22 Oct 2006 14:31:53 +0300 (EEST) (envelope-from jau) Message-Id: <200610221131.k9MBVrKa037929@jau.iki.fi> Date: Sun, 22 Oct 2006 14:31:53 +0300 (EEST) From: "Jukka A. Ukkonen" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/104675: Apparently there is a clash between two ioctls X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Jukka A. Ukkonen" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2006 12:00:34 -0000 >Number: 104675 >Category: kern >Synopsis: Apparently there is a clash between two ioctls >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Oct 22 12:00:32 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Jukka A. Ukkonen >Release: FreeBSD 6.2-PRERELEASE i386 >Organization: Private person >Environment: System: FreeBSD mjolnir 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #1: Wed Oct 18 08:04:30 EEST 2006 root@mjolnir:/usr/obj/usr/src/sys/Mjolnir i386 >Description: It seems that the bktr driver cannot change the input connector used when using a card with multiple connectors. When I used ktrace to see what happens at the kernel API level I got somewhat disturbing output... 56314 try CALL ioctl(0x3,METEORGINPUT,0xbfbfed24) 56314 try RET ioctl 0 56314 try CALL ioctl(0x3,SERIAL_SETINVCLK,0xbfbfed20) 56314 try RET ioctl 0 56314 try CALL ioctl(0x3,METEORGINPUT,0xbfbfed20) 56314 try RET ioctl 0 It seems that METEORGINPUT is recognized properly but its complement METEORSINPUT is not. Instead METEORSINPUT gets mapped to something completely unrelated (SERIAL_SETINVCLK). This make multiconnector BT cards completely useless, because only one connector can be used. Multiconnector cards would be the device of choice for purposes like video surveilance with motion capture etc. when one needs only one or two frames per camera per second. Because this makes a full class of devices useless and seriously harms every application which benefits from capturing a single frame now and then from multiple cameras, I classify this as a serious bug with high priority. Currently the only way to monitor multiple cameras is using multiple cards with a single functional connector per card. This is wasting card slots all too quickly when multiple cameras are needed. >How-To-Repeat: Try the following snippet. On my system there is no change. As a second test do the same attempts to change the input connector using ktrace to monitor the kernel API. The outcome should be like shown above, METEORSINPUT gets mixed with SERIAL_SETINVCLK. #include #include #include #include #include #include #include #include #include static const char bktr[] = "/dev/bktr"; int main (ac, av) int ac; char *av[]; { unsigned long oldval; unsigned long iocval; int iocret; int fd; char *endp; fd = open (bktr, O_RDWR, 0); if (fd < 0) { perror (bktr); exit (-1); } printf ("fd = %d\n", fd); if (ac > 1) { iocval = strtoul (av[1], &endp, 0); if ((endp <= av[1]) || (*endp && ! isspace (*endp))) { errno = EINVAL; fprintf (stderr, "%s: %s %s\r\n", av[0], av[1], strerror (errno)); exit (-1); } #if 0 #define METEOR_INPUT_DEV0 0x01000 /* camera input 0 -- default */ #define METEOR_INPUT_DEV_RCA METEOR_INPUT_DEV0 #define METEOR_INPUT_DEV1 0x02000 /* camera input 1 */ #define METEOR_INPUT_DEV2 0x04000 /* camera input 2 */ #define METEOR_INPUT_DEV3 0x08000 /* camera input 3 */ #define METEOR_INPUT_DEV_RGB 0x0a000 /* for rgb version of meteor */ #define METEOR_INPUT_DEV_SVIDEO 0x06000 /* S-video input port */ #endif iocval &= 0xf; switch (iocval) { case 0x1: case 0x2: case 0x4: case 0x6: case 0x8: case 0xa: break; default: errno = EINVAL; fprintf (stderr, "%s: %s %s\r\n", av[0], av[1], strerror (errno)); exit (-1); break; } iocval << 12; if ((iocret = ioctl (fd, METEORGINPUT, &oldval)) < 0) { fprintf (stderr, "%s: %s\r\n", bktr, strerror (errno)); exit (-1); } oldval &= ~0xf000; iocval |= oldval; if ((iocret = ioctl (fd, METEORSINPUT, &iocval)) < 0) { fprintf (stderr, "%s: %s\r\n", bktr, strerror (errno)); exit (-1); } } if ((iocret = ioctl (fd, METEORGINPUT, &iocval)) < 0) { fprintf (stderr, "%s: %s\r\n", bktr, strerror (errno)); exit (-1); } printf ("input channel = %d %lx %lu\n", iocret, iocval, (iocval >> 12)); exit (0); } >Fix: None yet. Supposedly requires a change in the kernel ioctl mappings. >Release-Note: >Audit-Trail: >Unformatted: