Skip to contentSkip to conversation

(?) since 3.16: USB video cam of an HP Pavilion dv7 laptop not working

BISECTED Jörg-Volker Peetz 2 participants 3 messages Sep 8, 2014 – Oct 1, 2014

lore
Share & tools
lore

Jörg-Volker Peetz

author Acked-by Alan Stern
#0 lore raw

Since 3.16 the builtin USB video cam of an HP Pavilion dv7 laptop shows only a black screen with the application guvcview although the video LED is turned on. There is no hint in dmesg. Also the output of guvcview shows no conspicuousness.

With kernel version 3.15.9 the camera works.

I tried to bisect between good v3.15 and bad v3.16, which identified

commit 9262c19d14c433a6a1ba25c3ff897cb89e412309

Author: Dan Williams <[email protected]>
Date:   Tue May 20 18:08:12 2014 -0700

usb: disable port power control if not supported in wHubCharacteristics

A hub indicates whether it supports per-port power control via the wHubCharacteristics field in its descriptor. If it is not supported a hub will still emulate ClearPortPower(PORT_POWER) requests by stopping the link state machine. However, since this does not save power do not bother suspending.

This also consolidates support checks into a
hub_is_port_power_switchable() helper.

In the bad bisection steps the video device even was not found. Therefore, I'm not sure if I identified the right culprit.

Thanks for any help,
Jörg-Volker.

#1 lore raw

Jörg-Volker Peetz wrote on 09/08/2014 17:17:

Quoted 23 lines

Since 3.16 the builtin USB video cam of an HP Pavilion dv7 laptop shows only a black screen with the application guvcview although the video LED is turned on. There is no hint in dmesg. Also the output of guvcview shows no conspicuousness.

With kernel version 3.15.9 the camera works.

I tried to bisect between good v3.15 and bad v3.16, which identified

commit 9262c19d14c433a6a1ba25c3ff897cb89e412309

Author: Dan Williams <[email protected]>
Date:   Tue May 20 18:08:12 2014 -0700

usb: disable port power control if not supported in wHubCharacteristics

A hub indicates whether it supports per-port power control via the wHubCharacteristics field in its descriptor. If it is not supported a hub will still emulate ClearPortPower(PORT_POWER) requests by stopping the link state machine. However, since this does not save power do not bother suspending.

This also consolidates support checks into a
hub_is_port_power_switchable() helper.

Quoted 7 lines

In the bad bisection steps the video device even was not found. Therefore, I'm not sure if I identified the right culprit.

As you suggested Dan, I reverted this commit on top of 3.16.0 (the commit could not be reverted cleanly, I had to do it manually, patch appended). But still I see a black picture from the camera. So this commit is not the culprit.

How to proceed with the bisection?

Signature · 2 lines
Regards,
Jörg-Volker.
hub.c renamed from hub.c.orig +6 -2
@@ -820,6 +820,8 @@ EXPORT_SYMBOL_GPL(usb_hub_clear_tt_buffe
 static void hub_power_on(struct usb_hub *hub, bool do_delay)
 {
 	int port1;
+	u16 wHubCharacteristics =
+			le16_to_cpu(hub->descriptor->wHubCharacteristics);
 
 	/* Enable power on each port.  Some hubs have reserved values
 	 * of LPSM (> 2) in their descriptors, even though they are
@@ -827,7 +829,7 @@ static void hub_power_on(struct usb_hub
 	 * but only emulate it.  In all cases, the ports won't work
 	 * unless we send these messages to the hub.
 	 */
-	if (hub_is_port_power_switchable(hub))
+	if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2)
 		dev_dbg(hub->intfdev, "enabling power on all ports\n");
 	else
 		dev_dbg(hub->intfdev, "trying to enable port power on "
@@ -4548,6 +4550,8 @@ static void hub_port_connect(struct usb_
 	unsigned unit_load;
 	struct usb_device *hdev = hub->hdev;
 	struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
+	unsigned wHubCharacteristics =
+			le16_to_cpu(hub->descriptor->wHubCharacteristics);
 	struct usb_port *port_dev = hub->ports[port1 - 1];
 	struct usb_device *udev = port_dev->child;
 
@@ -4586,7 +4590,7 @@ static void hub_port_connect(struct usb_
 			test_bit(port1, hub->removed_bits)) {
 
 		/* maybe switch power back on (e.g. root hub was reset) */
-		if (hub_is_port_power_switchable(hub)
+		if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
 				&& !port_is_power_on(hub, portstatus))
 			set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
 
hub.h renamed from hub.h.orig +0 -10
@@ -119,16 +119,6 @@ extern int hub_port_debounce(struct usb_
 extern int usb_clear_port_feature(struct usb_device *hdev,
 		int port1, int feature);
 
-static inline bool hub_is_port_power_switchable(struct usb_hub *hub)
-{
-	__le16 hcs;
-
-	if (!hub)
-		return false;
-	hcs = hub->descriptor->wHubCharacteristics;
-	return (le16_to_cpu(hcs) & HUB_CHAR_LPSM) < HUB_CHAR_NO_LPSM;
-}
-
 static inline int hub_is_superspeed(struct usb_device *hdev)
 {
 	return hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS;
port.c renamed from port.c.orig +3 -8
@@ -445,16 +445,11 @@ int usb_hub_create_port_device(struct us
 	 */
 	pm_runtime_set_active(&port_dev->dev);
 	pm_runtime_get_noresume(&port_dev->dev);
-	pm_runtime_enable(&port_dev->dev);
+	if (!dev_pm_qos_expose_flags(&port_dev->dev,
+			PM_QOS_FLAG_NO_POWER_OFF))
+		pm_runtime_enable(&port_dev->dev);
 	device_enable_async_suspend(&port_dev->dev);
 
-	/*
-	 * Keep hidden the ability to enable port-poweroff if the hub
-	 * does not support power switching.
-	 */
-	if (!hub_is_port_power_switchable(hub))
-		return 0;
-
 	/* Attempt to let userspace take over the policy. */
 	retval = dev_pm_qos_expose_flags(&port_dev->dev,
 			PM_QOS_FLAG_NO_POWER_OFF);
#2 lore raw
In reply to Jörg-Volker Peetz
Quoted 10 lines · Jörg-Volker Peetz

Since 3.16 the builtin USB video cam of an HP Pavilion dv7 laptop shows only a black screen with the application guvcview although the video LED is turned on. There is no hint in dmesg. Also the output of guvcview shows no conspicuousness.

With kernel version 3.15.9 the camera works.

I tried to bisect between good v3.15 and bad v3.16, which identified

commit 9262c19d14c433a6a1ba25c3ff897cb89e412309

...

Quoted 3 lines

Thanks for any help,
Jörg-Volker.

please have a look at
https://bugzilla.kernel.org/show_bug.cgi?id=81611

Due to a change in the driver, guvcview won't work with kernel 3.16. You have to revert up to two kernel commits or use the latest version of guvcview (git version >2.0.0)

regards
Dominik Kopp