Instead of hardcoding the max program size, pick it out of boards.txt, like we
pick the device VID and PID.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
The member functions of the union now take all arguments const, meaning
that it is not possible to modify this value somehow. This reduces the
chance of subtle bugs and widens the contexts in which these member
functions can be used.
Furthermore, one signature took a `Key' by value while all functions
take `Key' by reference. For the sake of consistency, this was adapted
to.
Making the member functions of Key `const' explicitly flags that they
will not change the union. This will allow to use Key in const contexts.
Adding the `constexpr' specifier to the function makes it possible to
rely on the results at compile time. This puts some kind of restrictions
on the function, especially when using C++11 and not a newer standard,
but these restrictions were already fulfilled, so this seems to be safe.
Updates the formatting a bit, and adds a few entries too. Still much to be done,
but... small steps!
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
By far the most common deprecation will be the event handler and loop hook
deprecation. Make them less scary, and point out that unless one's a developer,
they likely need not care.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Moving the deprecation messages to a separate header, and adding a few helpers
allow us to write much more detailed deprecation messages, without needlessly
making the code look incredibly messy.
This also updates most of the deprecation messages to be much more helpful, and
provide hints at how to fix the warnings produced by them.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Rearranged a little, so deprecation is a section, and we can put other things,
notes, into the document. With the rearrangement, added a section about the new
plugin API, and explained the API version bump too.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Due to the plugin API redesign, plugins that migrate may want to ensure they are
compiled against a recent enough Kaleidoscope. Others may opt to provide
separate implementations for each version. For this to work, we need to bump the
API version.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Fixed a conditional so that the event handlers of old-style plugins will be
called. Without this, they don't, and old-style plugins that install event
handlers, would not work.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
With this redesign, we introduce a new way to create plugins, which is easier to
extend with new hook points, provides a better interface, uses less memory, less
program space, and is a tiny bit faster too.
It all begins with `kaleidoscope::Plugin` being the base class, which provides
the hook methods plugins can implement. Plugins should be declared with
`KALEIDOSCOPE_INIT_PLUGINS` instead of `Kaleidoscope.use()`. Behind this macro
is a bit of magic (see the in-code documentation) that allows us to unroll the
hook method calls, avoid vtables, and so on. It creates an override for
`kaleidoscope::Hooks::*` methods, each of which will call the respective methods
of each initialized plugin.
With the new API come new names: all of the methods plugins can implement
received new, more descriptive names that all follow a similar pattern.
The old (dubbed V1) API still remains in place, although deprecated. One can
turn it off by setting the `KALEIDOSCOPE_ENABLE_V1_PLUGIN_API` define to zero,
while compiling the firmware.
This work is based on #276, written by @noseglasses. @obra and @algernon did
some cleaning up and applied a little naming treatment.
Signed-off-by: noseglasses <shinynoseglasses@gmail.com>
Signed-off-by: Jesse Vincent <jesse@keyboard.io>
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
This can be used to see the effect of changes on the core firmware alone,
without any plugins or the like.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Based on #306, with slightly improved text. Thanks to Ross Donaldson
(@Gastove) for the original pull request!
Closes#306.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Since keyboardio/Kaleidoscope-Hardware-Model01#23 we do not call
`handleKeyswitchEvent` for keys that are idle. Document this in the comments.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
There are a number of false-positives, where ShellCheck warns about behaviour we
do want, or are otherwise intentional.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
If the user has missed the step about setting up their account
with the right group membership, they would get a cryptic failure
from stty, so catch this and explain the problem.
This should never happen, but could if something goes badly wrong
in the device detection code, e.g. someone changing it in a way
which caused extra output on STDOUT.
7bd2e9fbb7/udev/99-hdmi2usb-mm-blacklist.rules (L4)
says:
It should be enough to set ID_MM_DEVICE_IGNORE:="1" but it seems many
versions of modem manager have a bug which makes them ignore that value.
Setting ID_MM_CANDIDATE:="0" has the same effect but is an "internal
implementation detail" of modem manager.
so set both to be safe. Also use := rather than =, in order to prevent
any later rules from overriding the settings.
Further testing suggests that macOS unconditionally replaces the final character with a
`1` (I tested with `kbio02` as the device short name, which became the "Serial Number"
`CDkbio02`, and it got changed to `CDkbio01` in the filename). This change will try
looking for any file that matches the serial number with the final character replaced with
"1" (not just if that charater is "E"). I also added some comments that might help update
the script in the future if the OS changes behaviour.
Several people have reported difficulty flashing firmware on macOS High Sierra because the
device port filename doesn't match the serial number from system_profiler. In particular,
system_profiler would return a string ending in `E` whereas the device filename would have
a `1`. This change adds a check for that filename explictily.
I also corrected the location_id fallback (the substring should have been just 3
characters long, not 4), and it works properly on my system if I make the device shortname
7 characters long, and the filename reverts to using the location id instead.
Last, I added one more check, simply listing the filenames, and searching for a match for
the string `kbio01`, which should be present (although in one case, it wasn't).