Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Teensy USB Keyboard - Power Management

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Posts
    240

    Teensy USB Keyboard - Power Management

    I have a composite device which include MIDI, rawHID, and keyboard interfaces. When I go into the Windows Device Manager and check the properties of the keyboard interface, I notice that there is no power management tab.

    I'd like to be able to use the composite device to wake my computer from sleep, but without that power management tab, it's not possible. Is there a way for the Teensy keyboard interface to support this functionality? Thanks in advance if you have any info to share.

    Rob

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,063
    doesnt your BIOS support wake from USB, aside from the OS?

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    Quote Originally Posted by tonton81 View Post
    doesnt your BIOS support wake from USB, aside from the OS?
    It certainly does. I'm guessing however that something in the device usb descriptors needs to be enabled.

    Rob

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,431
    If I were a guessing person, I would look at the USB descriptor:
    Code:
    / USB Configuration Descriptor.  This huge descriptor tells all
    // of the devices capbilities.
    static uint8_t config_descriptor[CONFIG_DESC_SIZE] = {
            // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
            9,                                      // bLength;
            2,                                      // bDescriptorType;
            LSB(CONFIG_DESC_SIZE),                 // wTotalLength
            MSB(CONFIG_DESC_SIZE),
            NUM_INTERFACE,                          // bNumInterfaces
            1,                                      // bConfigurationValue
            0,                                      // iConfiguration
            0xC0,                                   // bmAttributes
            50,                                     // bMaxPower
    At the bmAttributes: If you look at the attributes definition
    Code:
    D7 Reserved, set to 1. (USB 1.0 Bus Powered)
    D6 Self Powered
    D5 Remote Wakeup
    D4..0 Reserved, set to 0.
    You may try setting D5?

    When I look at a logitech keyboard on a Linux board:
    Code:
    kurt@kurt-UP-CHT01:~$ lsusb -v -d  046d:c517
    
    Bus 001 Device 002: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
    Couldn't open device, some information will be missing
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               1.10
      bDeviceClass            0 (Defined at Interface level)
      bDeviceSubClass         0
      bDeviceProtocol         0
      bMaxPacketSize0         8
      idVendor           0x046d Logitech, Inc.
      idProduct          0xc517 LX710 Cordless Desktop Laser
      bcdDevice           38.10
      iManufacturer           1
      iProduct                2
      iSerial                 0
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength           59
        bNumInterfaces          2
        bConfigurationValue     1
        iConfiguration          0
        bmAttributes         0xa0
          (Bus Powered)
          Remote Wakeup
        MaxPower               98mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         3 Human Interface Device
          bInterfaceSubClass      1 Boot Interface Subclass
          bInterfaceProtocol      1 Keyboard
          iInterface              0
            HID Device Descriptor:
              bLength                 9
              bDescriptorType        33
              bcdHID               1.10
              bCountryCode            0 Not supported
              bNumDescriptors         1
              bDescriptorType        34 Report
              wDescriptorLength      59
             Report Descriptors:
               ** UNAVAILABLE **
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0008  1x 8 bytes
            bInterval              10
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        1
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         3 Human Interface Device
          bInterfaceSubClass      1 Boot Interface Subclass
          bInterfaceProtocol      2 Mouse
          iInterface              0
            HID Device Descriptor:
              bLength                 9
              bDescriptorType        33
              bcdHID               1.10
              bCountryCode            0 Not supported
              bNumDescriptors         1
              bDescriptorType        34 Report
              wDescriptorLength     177
             Report Descriptors:
               ** UNAVAILABLE **
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x82  EP 2 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0008  1x 8 bytes
            bInterval              10
    kurt@kurt-UP-CHT01:~$
    That bit is set

    Forgot to mention: That this is in the teensy3\usb_desc.c file. And I don't know what else this might imply...

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    I'll look into that. Thank you. I also found this:
    http://download.microsoft.com/downlo...6c/Inpmspc.rtf

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,431
    It will be interesting to see what works:
    Lots of USB docs up on web. Like https://www.keil.com/pack/doc/mw/USB...escriptor.html

  7. #7
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    I changed the bmAttributes to 0xa0 and it definitely makes the Power Management tab show up, but my first tests seem to indicate that the Teensy is unable to wake the computer. I need to do more testing....
    Last edited by yeahtuna; 12-02-2017 at 01:21 AM.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    Quote Originally Posted by yeahtuna View Post
    I changed the bmAttributes to 0xa0 and it definitely makes the Power Management tab show up, but my first tests seem to indicate that the Teensy is unable to wake the computer. I need to do more testing....
    It's hard for me to say how well this is going to work. , As my computer has had a few sleeping issues since I updated to the fall creators update, but I can confirm that the teensy can wake the computer when the monitor has gone into power saving mode. Once I get the machine to sleep properly, I'll report more.

  9. #9
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    I did some more tests. When my computer is in S3 sleep, the teensy is not able to wake the computer, but interestingly the key that I press (the teensy generates) while the computer is sleeping is registered by the system once it's awake. I'll check what my power meter says is going on with the teensy once the computer enters sleep. Maybe that'll offer some hints.

  10. #10
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,431
    Again I have not tried any of this stuff nor know much about them. But in the document you posted in #5, there are some definitions for wakeup keys and or events.

    Not sure how easy it would be to generate these... Or to know you are in sleep state or not.

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    I'm guessing something needs to be implemented in usb_dev.c?

  12. #12
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    I think this might be even easier than I thought. Apparently there's a KEY_SYSTEM_WAKE_UP defined in keylayouts.h. Maybe sending that is the ticket.

  13. #13
    Senior Member
    Join Date
    Jun 2013
    Posts
    240
    I still can't get this to work. I'm pretty sure it won't work with the 'old' style keyboard type. Instead you'll need to use the new Multimedia Keyboard type. I've lost interest in this pursuit so.....

  14. #14
    Junior Member
    Join Date
    Nov 2017
    Posts
    2
    Hi, I am interested in this as I am facing same issue with an Teensy-LC to wake-up a windows 10 system from sleep. I tried changing the bmAttributes to 0xA0. As Yeahtuna mentioned the Power Management tab is showing in the device property. I enabled "allow the device to wake the computer" checked. But it seems not working. Is there any possible solution I can try to get this working?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •