Skip to content

Mouse and Keyboard are supported on the Micro #3982

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

Closed
wants to merge 1 commit into from

Conversation

obra
Copy link
Contributor

@obra obra commented Oct 15, 2015

The new Mouse and Keyboard error messages were inaccurate and misleading.

I'm thrilled that we're now warning users when they try to make a non-32u4 into a HID device. But we shouldn't steer them only toward one specific board when there are multiple totally legitimate official Arduino/Genuino boards that will work.

The new Mouse and Keyboard error messages were inaccurate and misleading.
@matthijskooijman
Copy link
Collaborator

Looks good to me.

@facchinm
Copy link
Member

@ORBA, Mouse and Keyboard are also supported on Due and Zero so, in my opinion, in the long run we should add a field to boards.txt to mark the board as usbdevice-ready.
Furthermore, with PluggableUSB inclusion, the error can also be displayed if you forgot to include "Mouse.h" which is yet another case

@cmaglie
Copy link
Member

cmaglie commented Oct 15, 2015

A better message could be:

'Mouse' not found. Have you included 'Mouse.h'? Does your board support USB Mouse?

But my preference is to remove completely the reference to the boards and just leave:

'Mouse' not found. Have you included 'Mouse.h'?

@cmaglie cmaglie added feature request A request to make an enhancement (not a bug fix) Component: IDE user interface The Arduino IDE's user interface Library: HID The HID Arduino library labels Oct 15, 2015
@cmaglie cmaglie self-assigned this Oct 15, 2015
@NicoHood
Copy link
Contributor

u2 board also support USB :P
I found this error confusing in general. Instead of a normal error you get an IDE special branded error.

Since Mouse and Keyboard are just APIs to generate USB report I'd leave out the USB stuff at all. If you look at my current HID Project dev version I created those APIs modular, so one can use the API so send the data via a Serial pipe to an USB AVR for example. (The IDE hasnt got this, just want to mention it).

One of @cmaglie s suggestions should be okay.

@NicoHood
Copy link
Contributor

Just found out how clever I am. Compiled my code accidentally for the Uno.

#if !defined(USBCON)
#error HID Project can only be used with an USB MCU.
#endif

Got: error: #error HID Project can only be used with an USB MCU.

So why do we need this check at all? We can fix this inside the code. (might differ for SAM)

@obra
Copy link
Contributor Author

obra commented Oct 15, 2015

On Thu, Oct 15, 2015 at 05:18:33AM -0700, Nico wrote:

u2 board also support USB :P
I found this error confusing in general. Instead of a normal error you get
an IDE special branded error.

I'd be perfectly happy to see it removed entirely.

I'm a little sad that the requirement placed on my initial dev branch
(that Mouse.begin() or Keyboard.begin() implicitly do these #requires,
so old code keeps working) got dropped, but I'm incredibly happy to see
the USB HID stack getting pluggable. I'm excited to try to port the
Keyboardio extended Keyboard and Mouse support to it.

@obra
Copy link
Contributor Author

obra commented Oct 15, 2015

'Mouse' not found. Have you included 'Mouse.h'?

Perhaps:

'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?

@NicoHood
Copy link
Contributor

What Keyboardio extended support? The internal Keyboard Mouse APIs are limited and thats intended. Dont know if you followed the other PRs but we decided to keep it simple and functional.

I've been working quite a lot now in the HID Project and just dropped an improved Keyboard API in the last commit. Feel free to contribute there or suggest new stuff.
NicoHood/HID@1a676a2

Edit: just remove it and use a proper #define like in any other library. No extra fancy stuff for internal libs. Equality you know.

@obra
Copy link
Contributor Author

obra commented Oct 15, 2015

On Thu, Oct 15, 2015 at 11:25:47AM -0700, Nico wrote:

What Keyboardio extended support? The internal Keyboard Mouse APIs are
limited and thats intended. Dont know if you followed the other PRs but we
decided to keep it simple and functional.

I'm absolutely thrilled with the core APIs being simple, functional and
pluggable. What I was referring to was the other features in the now
year+ old pull request where I aggregated and cleaned up all the other
old HID pull requests.

If I recall correctly, the big things we had that the core didn't yet
have:

  • Consumer Control
  • System Control
  • Ability to wake the host
  • Absolute mouse positioning
  • A full USB HID keyboard mapping, rather than the old ~PS2 emulation.
  • Slightly cleaned up code to support >6KRO in a non-boot-protocol
    compatible way. (That was just changing the key report size to a
    constant)
  • Ability to vary the amount of power requested from the host

Within the next few months, I need to actually get to a proper NKRO
implementation. All of this stuff, we'd be 100% happy to see upstream in
Arduino IF it makes sense for the core.

Of course, it sounds like you've made tremendous progress while I've
been away building hardware.

I've been working quite a lot now in the HID Project and just dropped an
improved Keyboard API in the last commit. Feel free to contribute there or
suggest new stuff

Awesome. I'll check it out. Thank you so much for pushing on all this
stuff!

[1]NicoHood/HID@1a676a2


Reply to this email directly or [2]view it on GitHub.

Reverse link: [3]unknown

References

Visible links

  1. NicoHood/HID@1a676a2
  2. Mouse and Keyboard are supported on the Micro #3982 (comment)
  3. Mouse and Keyboard are supported on the Micro #3982 (comment)

@NicoHood
Copy link
Contributor

Everything you mentioned is already working. USB wakeup is inside the core now.
System, Consumer etc is on the HID Project. NKRO as well. Different keyboard was (is currently broken) but can be patched within minutes (if i really want to) with the teensy API. RAWHID is also working (currently testing). and possibly many more i forgot about that just works now. like single reports instead of multiple. keyboard leds. bios support. multiple gamepads. you will see.

The wiki just lacks most information yet. If you think any feature is missing, open an issue at the hid project.

@obra
Copy link
Contributor Author

obra commented Oct 15, 2015

On Thu, Oct 15, 2015 at 11:54:09AM -0700, Nico wrote:

Everything you mentioned is already working. USB wakeup is inside the core
now.

That's amazingly wonderful news. Thank you!

@cmaglie
Copy link
Member

cmaglie commented Oct 22, 2015

@obra your last error sentence looks better, may you update your patch with that one?

@obra
Copy link
Contributor Author

obra commented Oct 22, 2015

Obsoleted by PR #4018

@NicoHood
Copy link
Contributor

And inside the Mouse.h file I suggest to check if the device is USB capable.

Also I am not sure if this check (in the PR) is still required then. I think this check is also a bit "unfair" to 3rd party libraries, because I cannot add such a check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface feature request A request to make an enhancement (not a bug fix) Library: HID The HID Arduino library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants