New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rtl872x] usb: HID #2659
[rtl872x] usb: HID #2659
Conversation
} else { | ||
return handleOutSetupRequest(req); | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we can remove the else
here, the above if
will always return directly.
return dev_->setupReply(req, nullptr, 0); | ||
} | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: To be consistent, add default
case. The following switch
does add default
.
} | ||
|
||
int HidClassDriver::setup(SetupRequest* req) { | ||
if (req->bmRequestTypeType != SetupRequest::TYPE_CLASS && req->bmRequestTypeType != SetupRequest::TYPE_STANDARD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: prefer to use CHECK()
. Same to other checks.
0xc0 // END_COLLECTION | ||
}; | ||
|
||
const size_t DEFAULT_HID_DESCRIPTOR_DIGITIZER_LEN = 65; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: constexpr
@@ -34,6 +34,7 @@ using namespace particle::usbd; | |||
namespace { | |||
|
|||
const char DEFAULT_NAME[] = HAL_PLATFORM_USB_PRODUCT_STRING " " "USB Serial"; | |||
const uint8_t DUMMY_IN_EP = 0x8a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: constexpr
07fe1a9
to
6f19fb8
Compare
Description
USB HID (Mouse / Keyboard) support for P2 / Photon 2.
Same APIs as previously on Photon / P1 / Electron:
https://docs.particle.io/reference/device-os/api/keyboard/keyboard/
https://docs.particle.io/reference/device-os/api/mouse/mouse/
Caveats
Mouse.moveTo()
might not be moving the cursor (at least on Linux). Might need to come up with a different digitizer descriptor. Wayland uses multiple pointers, so standard pointer doesn't move. Might be the same nowadays on Windows/OSX.