Wakeup the system

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
shebeique55

Re: Wakeup the system

Post by shebeique55 » Tue Mar 27, 2012 4:14 am

Hi,I'm confused with this problem,too. Have you finished the problem?I have tried the ways above,and as what you had done,it didn't work.I don't know what to do.How about you?

bvi
Posts: 2
Joined: Sun Jan 27, 2013 5:48 pm

Re: Wakeup the system

Post by bvi » Tue Jan 29, 2013 7:59 pm

1. USB host should support this.
2. In the descriptor to enable USBATTR_REMOTEWAKE.

Code: Select all

void wake_up_signal()
{
cli();
char ps_p = PORTD;
char ps_ddr = DDRD;
PORTD |=(1<<PD2);
PORTD &= ~(1<<PD1);
DDRD |= (1<<PD2)|(1<<PD1);
_delay_ms(100);
PORTD ^=(1<<PD2);
PORTD ^=(1<<PD1);
_delay_ms(3);
PORTD =ps_p;
DDRD = ps_ddr;
  sei();
}


It works =)

minii

Re: Wakeup the system

Post by minii » Sun May 26, 2013 8:29 pm

Very interesting. I cannot google how to set/use USBATTR_REMOTEWAKE in V-USB HID device (keyboard). Could you please explain how to implement and use this feature?

kalidomra
Posts: 2
Joined: Thu Sep 03, 2015 11:07 pm

Re: Wakeup the system

Post by kalidomra » Thu Sep 03, 2015 11:11 pm

This is a little old but I think V-USB is missing the USBATTR_REMOTEWAKE bit. Would it be correct to add it here in usbdrv.c:

Code: Select all

#if USB_CFG_IS_SELF_POWERED
    (1 << 7) | USBATTR_SELFPOWER | USBATTR_REMOTEWAKE,       /* attributes */
#else
    (1 << 7)|USBATTR_REMOTEWAKE,                           /* attributes */
#endif

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Wakeup the system

Post by christian » Fri Sep 04, 2015 11:47 am

Thanks for the hint! I've added it in the master branch on Github.

kalidomra
Posts: 2
Joined: Thu Sep 03, 2015 11:07 pm

Re: Wakeup the system

Post by kalidomra » Fri Sep 04, 2015 5:44 pm

Not sure if this is the right way or to add a user configurable variable to the config file and check it here with a pre-processor. Either way this works. The Power Management tab shows up in the windows device setting now.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Wakeup the system

Post by christian » Fri Sep 04, 2015 6:38 pm

It probably won't harm. I think the host is just prepared to receive remote wake.

robert

Re: Wakeup the system

Post by robert » Sun Oct 18, 2015 1:54 pm

I've implemented remote wakeup in my project of ps2usb translator and it works like charm :)

https://github.com/robszy/ps2usb/blob/m ... ard.c#L112

I only wait 10 ms and it never failed :)


regards,
Robert

Post Reply