NetBSD Problem Report #49783

From makoto@mx.ki.nu  Wed Mar 25 05:43:05 2015
Return-Path: <makoto@mx.ki.nu>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CA6A1A582D
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Mar 2015 05:43:05 +0000 (UTC)
Message-Id: <201503250543.t2P5h4Vl001108@mx.ki.nu>
Date: Wed, 25 Mar 2015 14:43:04 +0900 (JST)
From: makoto@ki.nu
Reply-To: makoto@ki.nu
To: gnats-bugs@NetBSD.org
Subject: USB WiFi ural0 rejects hw.acpi.sleep.state=3
X-Send-Pr-Version: 3.95

>Number:         49783
>Category:       kern
>Synopsis:       USB WiFi ural0 rejects hw.acpi.sleep.state=3
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 25 05:45:00 +0000 2015
>Closed-Date:    Sun May 10 03:01:24 +0000 2015
>Last-Modified:  Sun May 10 03:01:24 +0000 2015
>Originator:     Makoto Fujiwara
>Release:        NetBSD 7.99.6
>Organization:
KINU Corporation
>Environment:


System: NetBSD cf-r4.i.ki.nu 7.99.6 NetBSD 7.99.6 (GENERIC.201503170630Z) #0: Tue Mar 17 08:57:29 UTC 2015 builds@b42.netbsd.org:/home/builds/ab/HEAD/i386/201503170630Z-obj/home/source/ab/HEAD/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	If USB WiFi ural0 inserted, you may see:
	-----------------------
	ural0 at uhub1 port 2
	ural0: Buffalo WLI-U2-KG54, rev 2.00/0.01, addr 2
	ural0: MAC/BBP RT2570 (rev 0x03), RF RT2526
	ural0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
	ural0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps
	       18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
	-----------------------	
	Then
	"sysctl -w hw.acpi.sleep.state=3" is rejected as below.
	-----------------------	
	Mar 25 13:35:51 cf-r4 /netbsd: acpi0: entering state S3
	Mar 25 13:35:51 cf-r4 /netbsd: Devices without power management support: ural0
	Mar 25 13:35:51 cf-r4 /netbsd: acpi0: aborting suspend
	-----------------------	
>How-To-Repeat:
	1. Have (probably note) PC with "sysctl hw.acpi.sleep.states" include S3, say,
	   hw.acpi.sleep.states = S0 S3 S4 S5
	2. Have USB WiFi device of ural category.
	3. Install NetBSD 6.1.* or 7.99.*, and boots
	   (mikutter/teokure live USB by tsutsui may probably be fine)
	4. Insert above ural device into USB port.
	5. See when the following command typed with root privilidge
	   sysctl -w hw.acpi.sleep.state=3
>Fix:

	Looking with recent changes on if_run.c by nonaka@, 
	I made following, thanks.
--- sys/dev/usb/if_ural.c.~1.44.~	2013-01-22 21:40:43.000000000 +0900
+++ sys/dev/usb/if_ural.c	2015-03-25 11:18:58.000000000 +0900
@@ -524,6 +524,9 @@ ural_attach(device_t parent, device_t se
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
 	    sc->sc_dev);

+	if (!pmf_device_register(self, NULL, NULL))
+	  aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 }

@@ -537,6 +540,8 @@ ural_detach(device_t self, int flags)

 	s = splusb();

+	pmf_device_deregister(self);
+
 	ural_stop(ifp, 1);
 	usb_rem_task(sc->sc_udev, &sc->sc_task);
 	callout_stop(&sc->sc_scan_ch);

>Release-Note:

>Audit-Trail:
From: "NONAKA Kimihiro" <nonaka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49783 CVS commit: src/sys/dev/usb
Date: Wed, 8 Apr 2015 12:29:42 +0000

 Module Name:	src
 Committed By:	nonaka
 Date:		Wed Apr  8 12:29:42 UTC 2015

 Modified Files:
 	src/sys/dev/usb: if_ural.c

 Log Message:
 Add pmf hook.

 fix PR/49783 USB WiFi ural0 rejects hw.acpi.sleep.state=3.


 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.45 src/sys/dev/usb/if_ural.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: nonaka@NetBSD.org
State-Changed-When: Wed, 08 Apr 2015 12:41:32 +0000
State-Changed-Why:
Please test with if_ural.c rev.1.45.


From: Makoto Fujiwara <makoto@ki.nu>
To: nonaka@NetBSD.org
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/49783 (USB WiFi ural0 rejects hw.acpi.sleep.state=3)
Date: Sun, 10 May 2015 07:41:32 +0900

 | From: nonaka@NetBSD.org
 | Date: Wed,  8 Apr 2015 12:41:32 +0000 (UTC)

 > Synopsis: USB WiFi ural0 rejects hw.acpi.sleep.state=3

 > State-Changed-From-To: open->feedback
  ...
 > Please test with if_ural.c rev.1.45.

 Thank you, confirmed as fixed. Please close PR.
 Sorry for late to respond.
 Thanks again,
 ---
 Makoto Fujiwara, 

State-Changed-From-To: feedback->closed
State-Changed-By: nonaka@NetBSD.org
State-Changed-When: Sun, 10 May 2015 03:01:24 +0000
State-Changed-Why:
Submitter reports fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.