1
0
forked from drath/libratbag
Commit Graph

842 Commits

Author SHA1 Message Date
Peter Hutterer
f60f8a12ab tools: fix string parsing for LED colors 2017-03-31 15:07:01 +10:00
Peter Hutterer
fd348d456d tools: add missing LED_OFF switch case
And add the missing break
2017-03-31 15:07:01 +10:00
Peter Hutterer
0f73a97bc8 tools: move variable declaration up
We do C99, but not this :)
2017-03-31 15:07:01 +10:00
Peter Hutterer
7783f50110 tools: fix unused variable warnings 2017-03-31 15:07:01 +10:00
Benjamin Tissoires
b85fcd0cee hwdb: add missing G900 over USB entry
Allows to have the nice picture

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-03-22 11:49:19 +01:00
Benjamin Tissoires
3c879b7389 configure.ac: libratbag 0.6
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
v0.6
2017-03-22 11:05:22 +01:00
Benjamin Tissoires
44e7bc1c23 G-Skill: shut up compiler warnings
driver-gskill.c: In function ‘gskill_read_button’:
driver-gskill.c:791:3: warning: ‘event_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   ratbag_button_macro_set_event(macro, event_idx, type,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            event_data);
            ~~~~~~~~~~~
driver-gskill.c:791:3: warning: ‘type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   ratbag_button_macro_set_event(macro, event_idx, type,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            event_data);
            ~~~~~~~~~~~

Add a default case which should never get reached.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-03-22 11:05:22 +01:00
Benjamin Tissoires
0bcaeaeb33 doctext: fix various unresolved links
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-03-22 11:05:22 +01:00
Ilia guterman
da60f0748c driver-hidpp20: Add LED API (#113)
Read colors and effects from hidpp20 capable device
2017-03-22 02:25:00 +02:00
Wolf480pl
5418392143 Add more button scancodes to driver-logitech-g300
Apparently the mouse can be configured to send scancodes
for buttons 6-9.

Note: there's no meaning attached to scancode 0x118 in the kernel,
which is sent by button 9, but xev does detect it.
2017-03-21 09:15:43 +01:00
Ilia guterman
6c18b16a00 align ratbag-command usage documentation (#135) 2017-03-08 01:44:29 +02:00
Ilya Guterman
8e5ad717c4 ratbag-command: implement LED commands 2017-03-07 11:07:50 +10:00
alcomposer
1ff263f0a4 Add g300, g303, g900 SVG links to HWDB 2017-03-07 10:50:14 +10:00
alcomposer
e9f0ca4385 SVG Logitech G900 Data 2017-03-07 10:50:14 +10:00
alcomposer
079b67f111 add SVG Logitech G303 data (#131)
An SVG of the Logitech G303 mouse, can also pass as the G302 as very little difference between models
2017-03-06 16:56:03 +01:00
alcomposer
a224ef6d0b add logitech g300 svg data
Logitech g300 svg data. I don't have this mouse so not 100% sure about mappings.
2017-03-06 10:49:45 +10:00
Ilya Guterman
0c0a6d39cb Add the ability to set LED effects 2017-02-22 10:10:03 +10:00
Ilya Guterman
3439058a54 fix indentation in documentation 2017-02-17 15:02:43 +10:00
Ilya Guterman
6414f7901f hidpp20: Implement feature 0x8070: LED effects 2017-02-13 10:24:26 +10:00
mxmgh
4d6390ea66 Teach ratbag-command the "ratchet mode switch" special action name 2017-02-13 08:10:45 +10:00
Ilya Guterman
3f83d5057d libratbag api support LEDs 2017-02-10 09:48:32 +10:00
Clément Vuchener
67f1c00181 hidpp10: Fix and add some special action codes
I fixed resolution cycle up actually being resultion cycle down and added the missing cycle actions for resolutions and profiles.

Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com>
2017-01-24 07:41:22 +10:00
Clément Vuchener
c4013ca4b0 Add special actions for cycling down resolutions and profiles
Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com>
2017-01-24 07:41:22 +10:00
Thomas Hindoe Paaboel Andersen
25294d9a63 Add driver for the Logitech G300/G300s
Supports the common functionality exposed by libratbag:
 - selecting profile 1-3 (profiles cannot be disabled)
 - selecting resolution 1-4 (can also not be disabled)
 - report frequency
 - default resolution per profile
 - button actions: mouse button numbers or key+modifier
   (modifiers are just a bit field and can easly be set
   in the driver, but not included as libratbag does not
   support it yet)
 - LEDs are not yet hooked up but are just a table of 7
   different predifined colors.
 - Seting active profile and resolution are both implemented
   but only profile activation is in use. The resolution
   activation code is commented until supported from libratbag
   itself.

The G300 has an unusual way of numbering buttons:
Left:1, Right:2, Middle: 3

The purpose of report type 0xF2 is not known.
2017-01-09 09:33:58 +01:00
Ilya Guterman
7d241642f9 hidpp20: first parsing of feature 0x8070 - onboard profiles 2017-01-04 10:50:21 +10:00
Stephen Kitt
d1e42ac56c Copy all three bytes from parameters
In hidpp10_get_hidpp_notifications(), we want all three bytes from
parameters[], not parameters[0] twice. This matches
hidpp10_set_hidpp_notifications().

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2017-01-04 07:29:13 +10:00
Ilya Guterman
45129b2bc8 hidpp20: define internal LED structure 2016-12-05 14:09:22 +10:00
Lyude
0568b4c39d libratbag-private.h: Fix space before brace
This was bugging me :(.

Signed-off-by: Lyude <lyude@redhat.com>
2016-11-22 20:54:18 -05:00
Lyude
5b152a6c3f gskill: Add some missing profile fields
Must have missed these somewhere down the line when I was reading the
specs for this…

Signed-off-by: Lyude <lyude@redhat.com>
2016-11-22 19:25:09 -05:00
Lyude
52d4e35192 Add the ability to enable or disable profiles
This is especially important for the mx780, so we can get rid of the
rude workaround we currently have in the driver for it.

Signed-off-by: Lyude <lyude@redhat.com>

Changes since v1:
- Just have profile enable/disable in ratbag-command
- Use bool instead of int
Changes since v2:
- Remove leftover function, whoops
- Fix leftover ints to bools
- Lots of style fixes
2016-11-16 09:45:01 +10:00
Lyude
a1a3750bc8 gskill: Add profile_to_pdata()
Saves me some typing :).

Changes since v1:
- Turn profile_to_pdata() into inline function
2016-11-16 09:45:01 +10:00
Thomas Hindoe Paaboel Andersen
3cfda944d0 Update report rate on all resolutions if needed
For drivers without the capability
RATBAG_RESOLUTION_CAP_INDIVIDUAL_REPORT_RATE
we should update the report rate on all resolutions.
2016-10-28 09:30:52 +10:00
Thomas Hindoe Paaboel Andersen
852fc2da2d gitignore: add test-iconv-helper 2016-10-27 11:10:59 +10:00
Thomas Hindoe Paaboel Andersen
adefb2921b unset previous default resolution
Make sure that there can only be one resolution marked
as default.

The previous code allowed to set multiple resolutions
as default. To clean up any bad state we allways loop
all other resolutions and unset the default if neccesary.
2016-10-27 11:05:50 +10:00
Thomas Hindoe Paaboel Andersen
27a141fd87 only set dirty when changed 2016-10-27 11:05:50 +10:00
Lyude
2b63ca4935 gskill: Check for ret < 0 in gskill_read_profile_name()
This was only working before because we weren't actually returning the
profile size correctly. Fix that up as well.
2016-10-27 10:05:57 +10:00
Lyude
107d7e652f gskill: Specify the correct encoding for profile names
Only managed to notice then while working on enabling/disabling
profiles. Somewhere down the line the encoding we pass to
ratbag_utf8_to_enc() managed to get typoed, causing it to actually fail
and not show anything because of the iconv helpers not returning
negative error codes.
2016-10-27 10:05:57 +10:00
Lyude
7e8d40b57a libratbag-util: Add test suite for iconv helpers
After learning that just using this mouse was not the greatest way of
figuring out whether or not the iconv helpers worked, I decided to
write a few simple tests to ensure silly things like this don't happen
again.

Changes since v1:
- fix indentation
- Fix year in copyright on test-iconv-helper.c
- Use an encoding that's definitely invalid for the
  iconv_invalid_encoding test
- Add tests for a bunch of bad utf16le strings
- Add tests for converting emojis to/from utf16le. Just so we have some
  actually multibyte characters in here.
2016-10-27 10:05:57 +10:00
Lyude
6c40b18229 libratbag-util: Return correct length from ratbag_utf8_from_enc 2016-10-27 10:05:57 +10:00
Lyude
9d51d70f70 libratbag-util: Return -errno, not errno
Whoops
2016-10-27 10:05:57 +10:00
Thomas Hindoe Paaboel Andersen
96a9a0f6a4 Move a comment to the appropriate function
The comment was effects of changing the resolution
but was added to the getter instead of setter function.
2016-10-24 08:03:27 +10:00
Thomas Hindoe Paaboel Andersen
31b513e6d7 Fix typos in documentation 2016-10-24 08:03:27 +10:00
Benjamin Tissoires
d831d6e515 Add a release script to generate the announce email
Copied from Xorg/util/modular, the license should not be an issue
here.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-10-18 09:33:18 +10:00
Lyude
89de42ad8e gskill: Convert driver to new profile oriented API
Signed-off-by: Lyude <thatslyude@gmail.com>

Changes since v1:
- has_changed→dirty
Changes since v2:
- Change loop in gskill_commit_profiles(). Ended up being different then
  what we needed for enabling/disabling profiles. Anyway, we also needed to
  move around the call to gskill_reload_profile_data() so that we call it
  only once per commit, not once per profile write.
Changes since v3:
- commit_profiles->commit
2016-10-14 08:00:54 +10:00
Lyude
01fcef9b9d Introduce new profile-oriented API
Almost all of the devices we've worked with here are the same: they have
some sort of profile on them, and if they don't (which is quite rare)
it's rather easy to simulate one in the driver. In fact basically all of
the device drivers in ratbag just update the profile and rewrite it on
calls to the write_resolution_dpi() and write_button() calls. This is
annoying since profile writes can take a good bit of time, and we're
wasting a lot of time with redundant profile writes that way.

During XDC this year, we came up with an idea that makes more sense: a
profile oriented API. Instead of having multiple entrypoints in the API
to writing and updating the profile we just cache all of the profile
changes until ratbag_device_commit_profiles() is called, at which point
we do a single set of writes for each profile and button that changed.

This has a lot of advantages:
- Where the profile is and is not written out to the device is now
  explicit.
- Changing attributes of each profile won't result in any sort of delay
  up until the library user commits the profiles, allowing us to avoid
  hanging the application every time a simple attribute is changed.
- We can cut down on workarounds in drivers to cater to the previous
  API.

Since this commit doesn't handle converting all of the device drivers
over to the new API, we also add a temporary wrapper for devices that
haven't yet been converted to this new API so that they're still usable.
Once all of the drivers have been converted to the new API, the wrapper
will be removed along with the internal driver API calls.

Signed-off-by: Lyude <thatslyude@gmail.com>

Changes since v1:
- has_changed→dirty
- Change namespace to LIBRATBAG_0.5.0
Changes since v2:
- Remove unneeded note about not setting dirty bit
- commit_profiles->commit
- Make FIXMEs more obvious
- Minor styling nitpicks
- Split up capability check fixes into seperate patch
2016-10-14 08:00:54 +10:00
Lyude
2bcacfc1ac libratbag: Check for CAP_BUTTON_MACROS in ratbag_button_set_macro() 2016-10-14 08:00:54 +10:00
Lyude
1e2edefd93 libratbag: Check for CAP_BUTTON_KEY instead of write_button()
This makes more sense then the former, and we're going to need it anyway
since write_button() is being deprecated.
2016-10-14 08:00:54 +10:00
Lyude
3aabba255d gskill: Update checksum *after* updating profile name
Noticed this while adding support for profile commits. This is definitely
a bug.

Signed-off-by: Lyude <thatslyude@gmail.com>
2016-10-11 21:11:39 +02:00
Lyude
e543723856 Add support for the gskill-mx780
This commit adds complete (with the exception of LEDs and a few other
small things) support for configuring the G.Skill Ripjaws MX780. So far
this has been tested on firmware versions 19 and 21, and both of them
seem to work perfectly with this.

Changes since v1:
- Lots of style fixes
- Remove reset hook, comment out with #if 0 in case of usage in the
  future
- Add ret = -EAGAIN check in the loop in gskill_general_cmd()
- Explain why we wait longer then the spec says to in
  gskill_general_cmd()
- Check that buf[0] is set to GSKILL_GENERAL_CMD in gskill_general_cmd()
- Add some notes as to why we don't use gskill_general_cmd() in
  gskill_select_profile()
- Cleanup return codes, change gskill_general_cmd() so it only returns
  valid error codes. In places not using gskill_general_cmd(), do
    return rc < 0 ? rc : -EPROTO;
- Split command for selecting the macro to read/write from into it's own
  function, just like we do with the profile
- Move profile count workaround into it's own function, make explicit
  note of why it's needed
- Add proper support for reading/writing profile/macro names, ensure
  they aren't left blank so as to not confuse G.Skill's software
- Use HID kbd modifier codes for translating macro kbd modifier codes
- Use AS_MASK instead of (1 << foo) (apparently we already had this :)

Signed-off-by: Lyude <cpaul@redhat.com>
2016-10-06 14:12:10 +02:00
Lyude
eb8e4bbfa8 libratbag-util: Add ratbag_utf8_(to|from)_enc() helpers
Some simple helpers to make converting strings to/from UTF-8 easier.
Required for the G.Skill driver since the profile/macro names are stored
in UTF16-LE on the mouse, and must be non-empty in order to prevent
confusing the default G.Skill config software.

Changes since v1:
- Fix potential erroneous free() if we fail to decide the target string
2016-10-06 14:12:10 +02:00