Skip to content

Commit

Permalink
wip: fix windows detection
Browse files Browse the repository at this point in the history
  • Loading branch information
heiso committed May 12, 2024
1 parent 7be1e0f commit 6ab42d0
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions firmware/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,29 +874,51 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
}

case VENDOR_REQUEST_WEBUSB: {
return tud_control_status(rhport, request);
if (stage == CONTROL_STAGE_SETUP) {
return tud_control_status(rhport, request);
}

return true;
}

case VENDOR_REQUEST_MICROSOFT: {
if (request->wIndex == 7) {
// Get Microsoft OS 2.0 compatible descriptor
uint16_t total_len;
memcpy(&total_len, desc_ms_os_20 + 8, 2);
if (stage == CONTROL_STAGE_SETUP) {
if (request->wIndex == 7) {
// Get Microsoft OS 2.0 compatible descriptor
uint16_t total_len;
memcpy(&total_len, desc_ms_os_20 + 8, 2);

return tud_control_xfer(rhport, request, (void *)(uintptr_t)desc_ms_os_20, total_len);
}

return tud_control_xfer(rhport, request, (void *)(uintptr_t)desc_ms_os_20, total_len);
} else {
return false;
}

return false;
}

default:
break;
}
}

default:
case TUSB_REQ_TYPE_CLASS: {
if (stage == CONTROL_STAGE_SETUP) {
if (request->bRequest == 0x22) {
// response with status OK
return tud_control_status(rhport, request);
}

return false;
}

return true;
}

default: {
break;
}
}

return false;
}
Expand Down

0 comments on commit 6ab42d0

Please sign in to comment.