Wakeup the system
Wakeup the system
Hi,
in my keyboard project I want to implement a key to wake up the computer. Power off / sleep already works, while powering the system on seems to be a problem... nothing happens. I read something about a USB reset and/or "SEO". Any official word or code example on this? Thanks.
BTW, what is "USBATTR_REMOTEWAKE". Is this related?
Thanks.
in my keyboard project I want to implement a key to wake up the computer. Power off / sleep already works, while powering the system on seems to be a problem... nothing happens. I read something about a USB reset and/or "SEO". Any official word or code example on this? Thanks.
BTW, what is "USBATTR_REMOTEWAKE". Is this related?
Thanks.
Re: Wakeup the system
As far as I know, pulling D+ and D- to GND for a short period of time should suffice. This feature may have to be enabled in a descriptor, though. I'd have to read in the USB spec for details on how long to pull D+ and D- to GND and which bit in which descriptor to set...
Re: Wakeup the system
That would be really great. I experimented with SEO, USB reset and setting D+ to 1 but none of this worked.
Re: Wakeup the system
OK. The USB 1.1 spec (which you can download, it's public) says in section 7.1.7.5 Resume:
"J state" is the opposite of "idle state", so my assumption that it would be SE0 is wrong. Note the words "with remote wakeup capability".
And in section 9.6.2 about the configuration descriptor, table 9-8:
A device with remote wakeup capability may not generate resume signaling unless the bus has been
continuously in the Idle state for 5ms (TWTRSM). This allows the hubs to get into their Suspend state and
prepare for propagating resume signaling. The remote wakeup device must hold the resume signaling for
at least 1ms but for no more than 15ms (TDRSMUP). At the end of this period, the device stops driving the
bus (puts its drivers into the high-impedance state and does not drive the bus to the J state).
"J state" is the opposite of "idle state", so my assumption that it would be SE0 is wrong. Note the words "with remote wakeup capability".
And in section 9.6.2 about the configuration descriptor, table 9-8:
Code: Select all
bmAttributes Bitmap
D7: Reserved (set to one)
D6: Self-powered
D5: Remote Wakeup
D4...0: Reserved (reset to zero)
D7 is reserved and must be set to one for
historical reasons.
A device configuration that uses power from
the bus and a local source reports a non-zero
value in MaxPower to indicate the amount of
bus power required and sets D6. The actual
power source at runtime may be determined
using the GetStatus(DEVICE) request (see
Section 9.4.5).
If a device configuration supports remote
wakeup, D5 is set to one.
Re: Wakeup the system
Thanks. I must still be missing something. I suspected I had to use "USBATTR_REMOTEWAKE", so I had set this bit all the time.
In the meantime I tried all combinations of D+/D- high/low, still nothing.
In the meantime I tried all combinations of D+/D- high/low, still nothing.
Re: Wakeup the system
The spec also says that the device must implement the set/get functions for this attribute. Don't know whether the default implementation handles that....
Re: Wakeup the system
J state or K state?
I just looked into the spec and it says K there. J is idle.
I've set the bit for remote wakeup for USBRQ_GET_STATUS, but still nothing. Hmm.
I just looked into the spec and it says K there. J is idle.
I've set the bit for remote wakeup for USBRQ_GET_STATUS, but still nothing. Hmm.
Re: Wakeup the system
Sorry, I think I have mixed up J and K. Since the bus is in idle during suspend, you must change something. Otherwise the host can't detect the signal.
I have never tried this myself. Have you tried commercial USB devices whether they can wake up the host? This may be a configuration option of the operating system.
I have never tried this myself. Have you tried commercial USB devices whether they can wake up the host? This may be a configuration option of the operating system.
Re: Wakeup the system
Unfortunately I have no commercial USB hardware to test this with. In Windows on some devices you can enable a waking up feature (e.g. wake-on-lan). I've never seen this on HID devices, though. I read somewhere this feature would be enabled by default.
Well, I don't know... would be really great if someone else could do some tests. By the way, a working wake up function would be a cool addition in one of the next releases.
Well, I don't know... would be really great if someone else could do some tests. By the way, a working wake up function would be a cool addition in one of the next releases.
Re: Wakeup the system
My computer (a Mac) wakes up from sleep when I disconnect any device. Disconnect is indistinguishable from RESET/SE0 in the first place. So my guess was that USB RESET would wake up the host.
Re: Wakeup the system
Well. Actually I not only want to wake the system from sleep. I want it to power on as well. I have a PS2 keyboard that can do that. But PS2 is PS2 and USB is USB...
Does your USB keyboard have a power on key?
Does your USB keyboard have a power on key?
Re: Wakeup the system
I don't use an external keyboard. We have old Mac keyboards with a power key, but they fail to wake my computer from power-off. The trivial reason is that there is no USB power during power-off and thus no way for the keyboard to signal anything...
Re: Wakeup the system
By the way, I just measured that in soft off mode, D- and D+ are low, +5V is present. At the moment I'm in doubt it will ever work at all. At least not on my systems.
Re: Wakeup the system
This is not suspend mode, at least according to the specs...
Re: Wakeup the system
It was stupid to measure with the device disconnected, I guess... since a device has to signal its presence with a high on a data line. So, this is no real problem.
But I don't know what else I could test...
But I don't know what else I could test...