From owner-freebsd-bugs@FreeBSD.ORG Sun Feb 20 16:40:29 2005 Return-Path: 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 590BF16A4CE for ; Sun, 20 Feb 2005 16:40:29 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1094343D3F for ; Sun, 20 Feb 2005 16:40:29 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j1KGeSTR055917 for ; Sun, 20 Feb 2005 16:40:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id j1KGeSGo055916; Sun, 20 Feb 2005 16:40:28 GMT (envelope-from gnats) Resent-Date: Sun, 20 Feb 2005 16:40:28 GMT Resent-Message-Id: <200502201640.j1KGeSGo055916@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, Robert Millan Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1238616A4CE for ; Sun, 20 Feb 2005 16:39:15 +0000 (GMT) Received: from khazad.dyndns.org (137.red-62-57-138.user.auna.net [62.57.138.137]) by mx1.FreeBSD.org (Postfix) with ESMTP id 892D243D2D for ; Sun, 20 Feb 2005 16:39:14 +0000 (GMT) (envelope-from rmh@khazad.dyndns.org) Received: from rmh by khazad.dyndns.org with local (Exim 4.34) id 1D2td5-000KLU-NA for FreeBSD-gnats-submit@freebsd.org; Sun, 20 Feb 2005 17:08:19 +0100 Message-Id: Date: Sun, 20 Feb 2005 17:08:19 +0100 From: Robert Millan To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/77786: moused dies when unplugging mouse X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Robert Millan List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2005 16:40:29 -0000 >Number: 77786 >Category: bin >Synopsis: moused dies when unplugging mouse >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 20 16:40:28 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Robert Millan >Release: GNU/kFreeBSD 5.3-3 i686 >Organization: Debian >Environment: System: GNU/kFreeBSD aragorn 5.3-3 #0: Thu Feb 10 15:39:57 CET 2005 i686 GNU/KFreeBSD >Description: When moused is being used to process input from an USB mouse, and the mouse is dettached, causing the /dev/ums0 to disappear, moused will die (complains about open() failing). So after reattaching the mouse you'll have to restart the daemon manualy. With this patch, moused's behaviour is closer to what you'd expect from a daemon and instead of diing it polls de device untill it can be open again. >How-To-Repeat: >Fix: I'm not sure if this is exactly what you want. Perhaps you prefer to get rid of the strncmp check or comment it out? Anyway, this works well for me. --- src.old/usr.sbin/moused/moused.c 2005-02-20 16:47:05.000000000 +0100 +++ src/usr.sbin/moused/moused.c 2005-02-20 16:46:25.000000000 +0100 @@ -778,9 +778,9 @@ usage(); } - retry = 1; + retry = 0; if (strncmp(rodent.portname, "/dev/ums", 8) == 0) { - if (usbmodule() != 0) + if ((retry != 0) && (usbmodule() != 0)) retry = 5; } @@ -790,7 +790,7 @@ signal(SIGINT , cleanup); signal(SIGQUIT, cleanup); signal(SIGTERM, cleanup); - for (i = 0; i < retry; ++i) { + for (i = 0; i < retry || retry == 0; ++i) { if (i > 0) sleep(2); rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK); >Release-Note: >Audit-Trail: >Unformatted: