/* Sends the current status of the device to the host.  */
static void GetDeviceStatus(const USBDDriver *pDriver)
/* Sends the current status of the device to the host.  */
static void GetDeviceStatus(const USBDDriver *pDriver)
{
    static unsigned short data;
    const USBConfigurationDescriptor *pConfiguration;
    data = 0;
    if (USBD_IsHighSpeed()) {
        pConfiguration = pDriver->pDescriptors->pHsConfiguration;
    }
    else {
        pConfiguration = pDriver->pDescriptors->pFsConfiguration;
    }
    if (pDriver->cfgnum != 0) {
        if (USBConfigurationDescriptor_IsSelfPowered(pConfiguration)) {
            data |= 1;
        }
    }
    if (pDriver->isRemoteWakeUpEnabled) {
        data |= 2;
    }
    USBD_Write(0, &data, 2, 0, 0);
}