Author Topic: What will happen if the Host restarts, suspends or shutdown?  (Read 12776 times)

kiennguyen

  • Member
  • ***
  • Posts: 3
Hi,
Could you please advise what will happen if a host suspends (moves to standby mode), shutdowns or restarts?
I mean what the device will see in those cases.
Where can I find info in details for such kind of situations?
Looking forward to your response.

Thanks,
Kien

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: What will happen if the Host restarts, suspends or shutdown?
« Reply #1 on: July 08, 2015, 09:18:37 am »
Suspend occurs when the device is in the Idle state (no SOF (full and high speed) or low-speed keep-alive (low speed) for 3 msec or the device accepts a SetPortFeature(PORT_LINK_STATE, U3)) request (SuperSpeed/SuperSpeedPlus).

See 7.1.7.6 in the USB 2.0 spec and C.1.4 in USB 3.1.

Shutdown ends communications. Restart causes enumeration.

kiennguyen

  • Member
  • ***
  • Posts: 3
Re: What will happen if the Host restarts, suspends or shutdown?
« Reply #2 on: July 09, 2015, 04:52:38 am »
Hi Jan,
Thanks for your advice.

One more question about selective Suspend.
For some reasons, I don't want the host to suspend my device by selective suspend, but will suspend if the host goes to sleep. How can I do that only on the device firmware/hardware (without modifying anything on the host)?

Your response in details will be much appreciated.

Regards,
Kien

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: What will happen if the Host restarts, suspends or shutdown?
« Reply #3 on: July 09, 2015, 01:11:24 pm »
Why not?

I've met a lot of device designers who think they don't want to be suspended, but have no good reason for it. If the host suspends you, you're suspended and there's nothing the device can do about it. The device can't know if its selective or global. In fact several systems will selectively suspend every device before globally suspending everything.

You need to be involved in the host driver if you really want to change the host behavior. Best thing is to stop worrying about it.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: What will happen if the Host restarts, suspends or shutdown?
« Reply #4 on: July 09, 2015, 02:10:44 pm »
What Barry said. Use remote wakeup if the device needs the host's attention while suspended.

Bret

  • Frequent Contributor
  • ****
  • Posts: 68
Re: What will happen if the Host restarts, suspends or shutdown?
« Reply #5 on: July 09, 2015, 02:35:13 pm »
This seems to be another case of a misunderstanding the master-slave design of the USB architecture.  A device is a slave, and must do what the host (master) tells it to do when the host tells it to do it, even if it seems "unreasonable".  Period.

In the particular case of suspensions, as Barry stated, a device can't tell if it's a global or selective suspend, and it doesn't matter.  The device just needs to suspend, and then do whatever the host tells it to do next (probably, but not necessarily, resume).

You could issue a remote wakeup as Jan stated, but I think that would be a mistake.  You say you want to respond to a global resume and not a selective resume, but you don't know which one is actually happening.  If you send a remote wakeup and it's actually a global resume, you're going to resume the entire bus even though all you really wanted to do was resume yourself.  Remote wakeup is not supposed to be used to keep a specific device from being suspended, it's really designed as a way for the user to tell the entire system it needs to wakeup (such as by pressing a key on a keyboard or mouse).

kiennguyen

  • Member
  • ***
  • Posts: 3
Re: What will happen if the Host restarts, suspends or shutdown?
« Reply #6 on: July 12, 2015, 11:49:15 am »
Thank you all for your advice.

Kien