Steve Glendinning <steve@xxxxxxxxxxx> writes: >> Looking at the different ethernet drivers, the normal way do do this >> seems to be something like this in their .set_wol implementation: >> >> device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); >> >> >> where "adapter" is a netdev_priv private struct, "pdev" is a pci device >> and "wol" is an u32. I don't see any problem doing the same for USB >> network devices implementing ethtool "set_wol". > > Ahh, good spot. I've implemented this (patch below for reference) and > it still doesn't work: > > > $ cat /sys/bus/usb/devices/2-1.2/power/wakeup > disabled > > $ sudo ethtool -s eth2 wol p > > [ 1607.237767] smsc75xx 2-1.2:1.0 eth2: set_wol before > device_can_wakeup=1 device_may_wakeup=0 > [ 1607.237772] smsc75xx 2-1.2:1.0 eth2: set_wol after > device_can_wakeup=1 device_may_wakeup=1 > > $ cat /sys/bus/usb/devices/2-1.2/power/wakeup > disabled > > > Huh?! My debugging printk statements tell me I've succesfully set it, > but then the sysfs entry is disabled when I read it. Is something > else setting this back? > > My testing patch for reference (note this is against my tree with a > few to-be submitted patches so won't apply cleanly!): [..] > @@ -674,8 +653,19 @@ static int smsc75xx_ethtool_set_wol(struct net_device *net, > { > struct usbnet *dev = netdev_priv(net); > struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); > + int ret; > + > + netdev_info(dev->net, "set_wol before device_can_wakeup=%d > device_may_wakeup=%d\n", > + device_can_wakeup(&net->dev), device_may_wakeup(&net->dev)); > > pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE; > + > + ret = device_set_wakeup_enable(&net->dev, pdata->wolopts); You are touching the network device here. That should have been the USB device. Try something like ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts); instead. Bjørn -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html