From owner-svn-src-head@freebsd.org Tue Aug 23 19:54:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E074BBC42D9 for ; Tue, 23 Aug 2016 19:54:12 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 794D5146B for ; Tue, 23 Aug 2016 19:54:12 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x229.google.com with SMTP id q128so176156920wma.1 for ; Tue, 23 Aug 2016 12:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fxtsZcwfTmEDDs0ADbAbQRHOAzU0rHLbaXpKxuOe1pQ=; b=n4LUdvUIuXbpZ2CnyhcfYHI6zSPERSCTJmTWpD1Gk3PtSw5obpfdYuLbyBvFtrTz3m ZV1sw3dR32uuUONPHW5P34AhL+8LTA2F4pMxzVCq6yHMZoztAcEvY1cXbMvdynXLf4QA WpUIzr2quudx+nlpz5bgu5zYVZ8VZoRlcdCNnGn0LeSnT6jHrQVq/KPuQvvXRyEYYyGB EfiUX4fu7IfZF5RveF2iYIbJEsXrxEh/N7wqS8IgiD+wZpAII43kOWux6qb7znrW9pHA D4AqaPkbYVBtdTBMlVOInIczAwNaE7c2GoROhx7CIn+WASE0TB5ibxi0wl6O3csqaSUF lRzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fxtsZcwfTmEDDs0ADbAbQRHOAzU0rHLbaXpKxuOe1pQ=; b=AqR/9Y4OXvEpc1UwoIvZjcoZ38bzNPRRoGOEnZPXWxwU1/gxU0xJUv0Zcr2W3S5njT bE20cvCAuWi2VQn6iRPKViOh9fGmNdh25puf8ImiS3sPH5+wLVMdjEKHR3KwXHiULnNP KW/isWS5FdII/aDh0iRhJqmRk/zCAIox13fO64yEy1MCvOEzZv0QdhleBRvacj/rvNdQ gJyYYNyGo+FyORm2SmhkbwUqSYd5V3X//4PoHcVuAd2QqTxFCKTRz+ibeITiTvYvIxoE qZlW8peGZ4imBMELKgdOnbrc80VsFfM/Gn9f/W3Qu5mLFjpLwk3oGMt98o90SWqe+cz0 7rTQ== X-Gm-Message-State: AEkoouvuLgoMTOzGq9ILpJ3C92AhM7oYl1jGizEQrDPf3IyrS3VJOex0hRZnagtqDPCZESLT4qbzHtKDv7nTRqs4 X-Received: by 10.194.144.114 with SMTP id sl18mr23357980wjb.123.1471982050964; Tue, 23 Aug 2016 12:54:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.221.7 with HTTP; Tue, 23 Aug 2016 12:54:10 -0700 (PDT) In-Reply-To: <201608231950.u7NJoGD8035436@repo.freebsd.org> References: <201608231950.u7NJoGD8035436@repo.freebsd.org> From: Oliver Pinter Date: Tue, 23 Aug 2016 21:54:10 +0200 Message-ID: Subject: Re: svn commit: r304699 - head/sys/dev/usb/input To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 19:54:13 -0000 On 8/23/16, Bruce Evans wrote: > Author: bde > Date: Tue Aug 23 19:50:16 2016 > New Revision: 304699 > URL: https://svnweb.freebsd.org/changeset/base/304699 > > Log: > Fix key delay and repeat, part 1. > > kbdcontrol -r fast is documented to give a non-emulated atkbd's fastest > rate of 250.34, but is misimplemented to request this as 0.0. ukbd > supports many nonstandard rates, although it is currently too inaccurate > by a factor of several hundred for non-huge nonstandard rates to be > useful. It mapped 0.0 to 200.0. A repeat delay of 0 means a rate of > infinity which is quite fast, but physical constraints limit this to > a few MHz and the inaccuracies made it almost usable. > > Convert 0.0 to the documented 250.34. > > Also convert negative args and small args to the 250.34 minimal ones, > like atkbd does. This is for KDSETREPEAT -- the 2 versions of the > deprecated KDSETRAD have bounds checking. Keep not doing any bounds > checking or conversions for upper limits since nonstandard large > delays are useful for testing. > > The inaccuracies are dependent on HZ and the timeout implementation. > With the old timeout implementation and HZ = 1000, 200.0 probably > worked better to emulate 250.34 than 250.34 itself. HZ = 100 gives > roundoff errors that accidentally reduce the inaaccuracies, and > event timers reduce the inaccuracies even more, so 200.0 was giving > more like itself (perhaps 215.15 on average but sometimes close to > 10 msec repeat which is noticebly too fast). This commit makes 0.0 > noticeably too slow, like 250.34 always was. > > Modified: > head/sys/dev/usb/input/ukbd.c > > Modified: head/sys/dev/usb/input/ukbd.c Hi Bruce! Do you plan to MFC these changes to 10-STABLE? It would be really nice to see all of these improvements. > ============================================================================== > --- head/sys/dev/usb/input/ukbd.c Tue Aug 23 19:41:49 2016 (r304698) > +++ head/sys/dev/usb/input/ukbd.c Tue Aug 23 19:50:16 2016 (r304699) > @@ -1887,17 +1887,14 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_lon > if (!KBD_HAS_DEVICE(kbd)) { > return (0); > } > - if (((int *)arg)[1] < 0) { > - return (EINVAL); > - } > - if (((int *)arg)[0] < 0) { > - return (EINVAL); > - } > - if (((int *)arg)[0] < 200) /* fastest possible value */ > - kbd->kb_delay1 = 200; > - else > - kbd->kb_delay1 = ((int *)arg)[0]; > - kbd->kb_delay2 = ((int *)arg)[1]; > + /* > + * Convert negative, zero and tiny args to the same limits > + * as atkbd. We could support delays of 1 msec, but > + * anything much shorter than the shortest atkbd value > + * of 250.34 is almost unusable as well as incompatible. > + */ > + kbd->kb_delay1 = imax(((int *)arg)[0], 250); > + kbd->kb_delay2 = imax(((int *)arg)[1], 34); > return (0); > > #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >