forked from drath/libratbag
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf20845249 | ||
|
|
eb01399f26 | ||
|
|
c815654c94 | ||
|
|
f1ce908b50 | ||
|
|
fb07204d9f | ||
|
|
1e5648b11d | ||
|
|
0902e3420f | ||
|
|
698d8ab365 | ||
|
|
ad1fa22196 | ||
|
|
04ebd96bb7 | ||
|
|
09b5ae14b1 | ||
|
|
8aa127186c | ||
|
|
a962082173 | ||
|
|
5c0dbe4d5c | ||
|
|
5934816b11 | ||
|
|
28dd84713f | ||
|
|
11b31cf9bd | ||
|
|
dfd2d88953 | ||
|
|
6a097bd691 | ||
|
|
2776d1ce8e | ||
|
|
0834b210ca | ||
|
|
cc41adbbf9 | ||
|
|
63a666025f | ||
|
|
08ce9773dd | ||
|
|
f745734d90 |
41
.gitignore
vendored
41
.gitignore
vendored
@@ -1,7 +1,5 @@
|
|||||||
*.o
|
*.o
|
||||||
*.pc
|
*.pc
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
*.sig
|
*.sig
|
||||||
@@ -10,43 +8,4 @@
|
|||||||
*.patch
|
*.patch
|
||||||
*.rej
|
*.rej
|
||||||
*.trs
|
*.trs
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache/
|
|
||||||
config.guess
|
|
||||||
config.h
|
|
||||||
config.h.in
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
depcomp
|
|
||||||
install-sh
|
|
||||||
libtool
|
|
||||||
ltmain.sh
|
|
||||||
missing
|
|
||||||
stamp-h1
|
|
||||||
.libs/
|
|
||||||
.deps/
|
|
||||||
src/libratbag-version.h
|
|
||||||
doc/libratbag.doxygen
|
|
||||||
doc/html
|
|
||||||
tags
|
tags
|
||||||
test-driver
|
|
||||||
compile
|
|
||||||
m4
|
|
||||||
symbols-leak-test.log
|
|
||||||
test-build-cxx
|
|
||||||
test-build-linker
|
|
||||||
test-build-pedantic-c99
|
|
||||||
test-build-std-gnuc90
|
|
||||||
test-iconv-helper
|
|
||||||
test-suite.log
|
|
||||||
test-context
|
|
||||||
test-device
|
|
||||||
test-*.log
|
|
||||||
ratbag-command
|
|
||||||
hidpp10-dump-page
|
|
||||||
hidpp20-dump-page
|
|
||||||
lur-command
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
test -n "$srcdir" || srcdir=`dirname "$0"`
|
|
||||||
test -n "$srcdir" || srcdir=.
|
|
||||||
(
|
|
||||||
cd "$srcdir" &&
|
|
||||||
autoreconf --force -v --install
|
|
||||||
) || exit
|
|
||||||
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
|
|
||||||
31
meson.build
31
meson.build
@@ -1,7 +1,7 @@
|
|||||||
project('libratbag', 'c', 'cpp',
|
project('libratbag', 'c', 'cpp',
|
||||||
version : '0.7.0',
|
version : '0.8.0',
|
||||||
license : 'MIT/Expat',
|
license : 'MIT/Expat',
|
||||||
default_options : [ 'c_std=gnu99' ])
|
default_options : [ 'c_std=gnu99', 'warning_level=2' ])
|
||||||
|
|
||||||
libratbag_version = meson.project_version().split('.')
|
libratbag_version = meson.project_version().split('.')
|
||||||
|
|
||||||
@@ -14,10 +14,10 @@ libratbag_version = meson.project_version().split('.')
|
|||||||
# been preserved, change to C+1:0:A+1
|
# been preserved, change to C+1:0:A+1
|
||||||
# c) If the interface is the same as the previous version, change to C:R+1:A
|
# c) If the interface is the same as the previous version, change to C:R+1:A
|
||||||
libratbag_so_c=4
|
libratbag_so_c=4
|
||||||
libratbag_so_r=1
|
libratbag_so_r=2
|
||||||
libratbag_so_a=0
|
libratbag_so_a=0
|
||||||
liblur_so_c=3
|
liblur_so_c=3
|
||||||
liblur_so_r=1
|
liblur_so_r=2
|
||||||
liblur_so_a=0
|
liblur_so_a=0
|
||||||
|
|
||||||
# convert to sonames
|
# convert to sonames
|
||||||
@@ -29,7 +29,7 @@ liblur_so_version = '@0@.@1@.@2@'.format((liblur_so_c-liblur_so_a),
|
|||||||
# Compiler setup
|
# Compiler setup
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
cpp = meson.get_compiler('cpp')
|
cpp = meson.get_compiler('cpp')
|
||||||
cppflags = ['-Wall', '-Wextra', '-Wno-unused-parameter', '-g', '-fvisibility=hidden']
|
cppflags = ['-Wno-unused-parameter', '-fvisibility=hidden']
|
||||||
cflags = cppflags + ['-Wmissing-prototypes', '-Wstrict-prototypes']
|
cflags = cppflags + ['-Wmissing-prototypes', '-Wstrict-prototypes']
|
||||||
add_project_arguments(cflags, language: 'c')
|
add_project_arguments(cflags, language: 'c')
|
||||||
add_project_arguments(cppflags, language: 'cpp')
|
add_project_arguments(cppflags, language: 'cpp')
|
||||||
@@ -146,10 +146,9 @@ libratbag_version_h_config = configuration_data()
|
|||||||
libratbag_version_h_config.set('LIBRATBAG_VERSION_MAJOR', libratbag_version[0])
|
libratbag_version_h_config.set('LIBRATBAG_VERSION_MAJOR', libratbag_version[0])
|
||||||
libratbag_version_h_config.set('LIBRATBAG_VERSION_MINOR', libratbag_version[1])
|
libratbag_version_h_config.set('LIBRATBAG_VERSION_MINOR', libratbag_version[1])
|
||||||
libratbag_version_h_config.set('LIBRATBAG_VERSION_MICRO', libratbag_version[2])
|
libratbag_version_h_config.set('LIBRATBAG_VERSION_MICRO', libratbag_version[2])
|
||||||
libratbag_version_h_config.set('LIBRATBAG_VERSION', meson.project_version())
|
libratbag_version_h_config.set_quoted('LIBRATBAG_VERSION', meson.project_version())
|
||||||
|
|
||||||
libratbag_version_h = configure_file(
|
libratbag_version_h = configure_file(
|
||||||
ratbag : 'src/libratbag-version.h.in',
|
|
||||||
output : 'libratbag-version.h',
|
output : 'libratbag-version.h',
|
||||||
configuration : libratbag_version_h_config,
|
configuration : libratbag_version_h_config,
|
||||||
install: false,
|
install: false,
|
||||||
@@ -172,12 +171,18 @@ dep_libratbag = declare_dependency(
|
|||||||
dependencies : deps_libratbag
|
dependencies : deps_libratbag
|
||||||
)
|
)
|
||||||
|
|
||||||
pkgconfig.generate(
|
pkgconfigdata = configuration_data()
|
||||||
filebase: 'libratbag',
|
pkgconfigdata.set('prefix', get_option('prefix'))
|
||||||
name: 'Libratbag',
|
pkgconfigdata.set('libdir', get_option('libdir'))
|
||||||
description: 'Mouse configuration library',
|
pkgconfigdata.set('datadir', get_option('datadir'))
|
||||||
version: meson.project_version(),
|
pkgconfigdata.set('includedir', get_option('includedir'))
|
||||||
libraries: lib_libratbag
|
pkgconfigdata.set('LIBRATBAG_VERSION', meson.project_version())
|
||||||
|
pkgconfigfile = configure_file(
|
||||||
|
input : 'src/libratbag.pc.in',
|
||||||
|
output : 'libratbag.pc',
|
||||||
|
configuration : pkgconfigdata,
|
||||||
|
install : true,
|
||||||
|
install_dir : get_option('libdir') + '/pkgconfig'
|
||||||
)
|
)
|
||||||
|
|
||||||
#### libshared.a ####
|
#### libshared.a ####
|
||||||
|
|||||||
@@ -731,8 +731,10 @@ gskill_macro_from_report(struct ratbag_device *device,
|
|||||||
ret = ratbag_utf8_from_enc(report->macro_name,
|
ret = ratbag_utf8_from_enc(report->macro_name,
|
||||||
report->macro_name_length, "UTF-16LE",
|
report->macro_name_length, "UTF-16LE",
|
||||||
¯o->macro.name);
|
¯o->macro.name);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
ratbag_button_macro_unref(macro);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0, event_idx = 0, increment = 1;
|
for (i = 0, event_idx = 0, increment = 1;
|
||||||
i < report->macro_length;
|
i < report->macro_length;
|
||||||
|
|||||||
@@ -909,12 +909,15 @@ hidpp20_log(void *userdata, enum hidpp_log_priority priority, const char *format
|
|||||||
static void
|
static void
|
||||||
hidpp20drv_remove(struct ratbag_device *device)
|
hidpp20drv_remove(struct ratbag_device *device)
|
||||||
{
|
{
|
||||||
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
|
struct hidpp20drv_data *drv_data;
|
||||||
struct hidpp20_device *dev = drv_data->dev;
|
struct hidpp20_device *dev;
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
drv_data = ratbag_get_drv_data(device);
|
||||||
|
dev = drv_data->dev;
|
||||||
|
|
||||||
ratbag_close_hidraw(device);
|
ratbag_close_hidraw(device);
|
||||||
|
|
||||||
if (drv_data->profiles)
|
if (drv_data->profiles)
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ roccat_wait_ready(struct ratbag_device *device)
|
|||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
msleep(10);
|
msleep(10);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
|
|||||||
@@ -26,13 +26,12 @@
|
|||||||
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
|
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifndef HIDPP_GENERIC_H
|
|
||||||
#define HIDPP_GENERIC_H
|
|
||||||
|
|
||||||
#define HIDPP_RECEIVER_IDX 0xFF
|
#define HIDPP_RECEIVER_IDX 0xFF
|
||||||
#define HIDPP_WIRED_DEVICE_IDX 0x00
|
#define HIDPP_WIRED_DEVICE_IDX 0x00
|
||||||
|
|
||||||
@@ -211,5 +210,3 @@ hidpp_get_unaligned_be_u32(uint8_t *buf)
|
|||||||
{
|
{
|
||||||
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HIDPP_GENERIC_H */
|
|
||||||
|
|||||||
@@ -1397,7 +1397,7 @@ hidpp10_profile_set_names(struct hidpp10_device *dev, struct hidpp10_profile *pr
|
|||||||
memcpy(metadata->lgs02.marker, "LGS02", sizeof(metadata->lgs02.marker));
|
memcpy(metadata->lgs02.marker, "LGS02", sizeof(metadata->lgs02.marker));
|
||||||
hidpp10_uchar8_to_uchar16(metadata->lgs02.name,
|
hidpp10_uchar8_to_uchar16(metadata->lgs02.name,
|
||||||
profile->name,
|
profile->name,
|
||||||
sizeof(metadata->lgs02.name));
|
ARRAY_LENGTH(metadata->lgs02.name));
|
||||||
for (i = 0; i < ARRAY_LENGTH(metadata->lgs02.macro_names); i++) {
|
for (i = 0; i < ARRAY_LENGTH(metadata->lgs02.macro_names); i++) {
|
||||||
hidpp10_uchar8_to_uchar16(metadata->lgs02.macro_names[i],
|
hidpp10_uchar8_to_uchar16(metadata->lgs02.macro_names[i],
|
||||||
profile->macro_names[i],
|
profile->macro_names[i],
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
|
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HIDPP_10_H
|
#pragma once
|
||||||
#define HIDPP_10_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -695,5 +694,3 @@ hidpp10_get_firmare_information(struct hidpp10_device *dev,
|
|||||||
uint8_t *major,
|
uint8_t *major,
|
||||||
uint8_t *minor,
|
uint8_t *minor,
|
||||||
uint8_t *build_number);
|
uint8_t *build_number);
|
||||||
|
|
||||||
#endif /* HIDPP_10_H */
|
|
||||||
|
|||||||
@@ -1583,8 +1583,8 @@ hidpp20_onboard_profiles_parse_macro(struct hidpp20_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
hidpp20_onboard_profiles_compute_dict_size(struct hidpp20_device *device,
|
hidpp20_onboard_profiles_compute_dict_size(const struct hidpp20_device *device,
|
||||||
struct hidpp20_profiles *profiles)
|
const struct hidpp20_profiles *profiles)
|
||||||
{
|
{
|
||||||
unsigned p, num_offset;
|
unsigned p, num_offset;
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
|
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HIDPP_20_H
|
#pragma once
|
||||||
#define HIDPP_20_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -544,5 +543,3 @@ hidpp20_onboard_profiles_read_memory(struct hidpp20_device *device,
|
|||||||
#define HIDPP_PAGE_MOUSE_BUTTON_SPY 0x8110
|
#define HIDPP_PAGE_MOUSE_BUTTON_SPY 0x8110
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* HIDPP_20_H */
|
|
||||||
|
|||||||
11
src/liblur.c
11
src/liblur.c
@@ -38,6 +38,13 @@
|
|||||||
#define _EXPORT_ __attribute__ ((visibility("default")))
|
#define _EXPORT_ __attribute__ ((visibility("default")))
|
||||||
#define MAX_DEVICES 6
|
#define MAX_DEVICES 6
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
cleanup_hidpp10_device_destroy(struct hidpp10_device **hidpp10_device) {
|
||||||
|
if (*hidpp10_device)
|
||||||
|
hidpp10_device_destroy(*hidpp10_device);
|
||||||
|
}
|
||||||
|
#define _cleanup_hidpp10_device_destroy_ _cleanup_(cleanup_hidpp10_device_destroy)
|
||||||
|
|
||||||
struct lur_receiver {
|
struct lur_receiver {
|
||||||
int refcount;
|
int refcount;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -186,7 +193,7 @@ lur_receiver_enumerate(struct lur_receiver *lur,
|
|||||||
dev->present = false;
|
dev->present = false;
|
||||||
|
|
||||||
for (i = 0; i < MAX_DEVICES; i++) {
|
for (i = 0; i < MAX_DEVICES; i++) {
|
||||||
struct hidpp10_device *d;
|
_cleanup_hidpp10_device_destroy_ struct hidpp10_device *d;
|
||||||
size_t name_size = 64;
|
size_t name_size = 64;
|
||||||
char name[name_size];
|
char name[name_size];
|
||||||
uint8_t interval, type;
|
uint8_t interval, type;
|
||||||
@@ -240,8 +247,6 @@ lur_receiver_enumerate(struct lur_receiver *lur,
|
|||||||
dev->present = true;
|
dev->present = true;
|
||||||
list_insert(&lur->devices, &dev->node);
|
list_insert(&lur->devices, &dev->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
hidpp10_device_destroy(d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
devices = zalloc(MAX_DEVICES * sizeof(*devices));
|
devices = zalloc(MAX_DEVICES * sizeof(*devices));
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LIBLUR_H_
|
#pragma once
|
||||||
#define _LIBLUR_H_ 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -268,4 +267,3 @@ lur_device_get_user_data(const struct lur_device *dev);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
datarootdir=@datarootdir@
|
|
||||||
pkgdatadir=@datadir@/@PACKAGE@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: Liblur
|
|
||||||
Description: Logitech Unifying Receiver configuration library
|
|
||||||
Version: @LIBRATBAG_VERSION@
|
|
||||||
Cflags: -I${includedir}
|
|
||||||
Libs: -L${libdir} -llur
|
|
||||||
Libs.private: -lm -lrt
|
|
||||||
@@ -21,8 +21,7 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBRATBAG_HIDRAW_H
|
#pragma once
|
||||||
#define LIBRATBAG_HIDRAW_H
|
|
||||||
|
|
||||||
#include <linux/hid.h>
|
#include <linux/hid.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -186,4 +185,3 @@ ratbag_hidraw_get_keycode_from_consumer_usage(struct ratbag_device *device,
|
|||||||
uint16_t
|
uint16_t
|
||||||
ratbag_hidraw_get_consumer_usage_from_keycode(struct ratbag_device *device,
|
ratbag_hidraw_get_consumer_usage_from_keycode(struct ratbag_device *device,
|
||||||
unsigned keycode);
|
unsigned keycode);
|
||||||
#endif /* LIBRATBAG_HIDRAW_H */
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBRATBAG_PRIVATE_H
|
#pragma once
|
||||||
#define LIBRATBAG_PRIVATE_H
|
|
||||||
|
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -491,5 +490,3 @@ void
|
|||||||
ratbag_button_copy_macro(struct ratbag_button *button,
|
ratbag_button_copy_macro(struct ratbag_button *button,
|
||||||
const struct ratbag_button_macro *macro);
|
const struct ratbag_button_macro *macro);
|
||||||
|
|
||||||
#endif /* LIBRATBAG_PRIVATE_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef LIBRATBAG_TEST_H
|
#pragma once
|
||||||
#define LIBRATBAG_TEST_H
|
|
||||||
|
|
||||||
#include "libratbag.h"
|
#include "libratbag.h"
|
||||||
|
|
||||||
@@ -84,4 +83,3 @@ struct ratbag_test_device {
|
|||||||
struct ratbag_device* ratbag_device_new_test_device(struct ratbag *ratbag,
|
struct ratbag_device* ratbag_device_new_test_device(struct ratbag *ratbag,
|
||||||
struct ratbag_test_device *test_device);
|
struct ratbag_test_device *test_device);
|
||||||
|
|
||||||
#endif /* LIBRATBAG_TEST_H */
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ ratbag_utf8_from_enc(char *in_buf, size_t in_len, const char *from_enc,
|
|||||||
/*
|
/*
|
||||||
* We *could* dynamically allocate the out buffer. However iconv's
|
* We *could* dynamically allocate the out buffer. However iconv's
|
||||||
* obnoxious semantics, mainly the fact that it modifies every pointer
|
* obnoxious semantics, mainly the fact that it modifies every pointer
|
||||||
* given to it, would make this code a lot larger and complex then it
|
* given to it, would make this code a lot larger and complex than it
|
||||||
* needs to be for a mouse with blinking lights.
|
* needs to be for a mouse with blinking lights.
|
||||||
*
|
*
|
||||||
* So, since there's no encoding that takes more then 6 bytes per
|
* So, since there's no encoding that takes more then 6 bytes per
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBRATBAG_UTIL_H
|
#pragma once
|
||||||
#define LIBRATBAG_UTIL_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -217,4 +216,3 @@ ratbag_utf8_to_enc(char *buf, size_t buf_len, const char *to_enc,
|
|||||||
ssize_t
|
ssize_t
|
||||||
ratbag_utf8_from_enc(char *in_buf, size_t in_len, const char *from_enc,
|
ratbag_utf8_from_enc(char *in_buf, size_t in_len, const char *from_enc,
|
||||||
char **out);
|
char **out);
|
||||||
#endif /* LIBRATBAG_UTIL_H */
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2013 Jonas Ådahl
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice (including the next
|
|
||||||
* paragraph) shall be included in all copies or substantial portions of the
|
|
||||||
* Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LIBRATBAG_VERSION_H
|
|
||||||
#define LIBRATBAG_VERSION_H
|
|
||||||
|
|
||||||
#define LIBRATBAG_VERSION_MAJOR @LIBRATBAG_VERSION_MAJOR@
|
|
||||||
#define LIBRATBAG_VERSION_MINOR @LIBRATBAG_VERSION_MINOR@
|
|
||||||
#define LIBRATBAG_VERSION_MICRO @LIBRATBAG_VERSION_MICRO@
|
|
||||||
#define LIBRATBAG_VERSION "@LIBRATBAG_VERSION@"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1292,7 +1292,7 @@ ratbag_button_set_key(struct ratbag_button *button,
|
|||||||
LIBRATBAG_EXPORT enum ratbag_error_code
|
LIBRATBAG_EXPORT enum ratbag_error_code
|
||||||
ratbag_button_disable(struct ratbag_button *button)
|
ratbag_button_disable(struct ratbag_button *button)
|
||||||
{
|
{
|
||||||
struct ratbag_button_action action;
|
struct ratbag_button_action action = {0};
|
||||||
|
|
||||||
if (!ratbag_device_has_capability(button->profile->device,
|
if (!ratbag_device_has_capability(button->profile->device,
|
||||||
RATBAG_DEVICE_CAP_BUTTON_KEY))
|
RATBAG_DEVICE_CAP_BUTTON_KEY))
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBRATBAG_H
|
#pragma once
|
||||||
#define LIBRATBAG_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1818,4 +1817,3 @@ ratbag_led_unref(struct ratbag_led *led);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* LIBRATBAG_H */
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
prefix=@prefix@
|
prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
datadir=${prefix}/@datadir@
|
||||||
datarootdir=@datarootdir@
|
pkgdatadir=${datadir}/libratbag
|
||||||
pkgdatadir=@datadir@/@PACKAGE@
|
libdir=${prefix}/@libdir@
|
||||||
libdir=@libdir@
|
includedir=${prefix}/@includedir@
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: Libratbag
|
Name: Libratbag
|
||||||
Description: Mouse configuration library
|
Description: Mouse configuration library
|
||||||
|
|||||||
@@ -20,10 +20,7 @@
|
|||||||
* OF THIS SOFTWARE.
|
* OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef USB_IDS_H
|
#pragma once
|
||||||
#define USB_IDS_H
|
|
||||||
|
|
||||||
#define USB_VENDOR_ID_LOGITECH 0x046d
|
#define USB_VENDOR_ID_LOGITECH 0x046d
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ disconnect_device(struct lur_receiver *receiver, int index)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= ndevices) {
|
if (index < 0 || index >= ndevices) {
|
||||||
fprintf(stderr, "Invalid index %d, only %d devices connected\n",
|
fprintf(stderr, "Invalid index %d, only %d devices connected\n",
|
||||||
index, ndevices);
|
index, ndevices);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -35,9 +35,11 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
|
||||||
|
#include "libratbag-version.h"
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
enum options {
|
enum options {
|
||||||
|
OPT_VERSION,
|
||||||
OPT_VERBOSE,
|
OPT_VERBOSE,
|
||||||
OPT_HELP,
|
OPT_HELP,
|
||||||
};
|
};
|
||||||
@@ -187,6 +189,12 @@ usage(void)
|
|||||||
program_invocation_short_name);
|
program_invocation_short_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
version(void)
|
||||||
|
{
|
||||||
|
printf("%s\n", LIBRATBAG_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
ratbag_cmd_device_from_arg(struct ratbag *ratbag,
|
ratbag_cmd_device_from_arg(struct ratbag *ratbag,
|
||||||
int *argc, char **argv,
|
int *argc, char **argv,
|
||||||
@@ -435,7 +443,7 @@ ratbag_cmd_info(const struct ratbag_cmd *cmd,
|
|||||||
led = ratbag_led_unref(led);
|
led = ratbag_led_unref(led);
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = ratbag_profile_unref(profile);
|
ratbag_profile_unref(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@@ -755,7 +763,7 @@ ratbag_cmd_list_supported_devices(const struct ratbag_cmd *cmd,
|
|||||||
device = ratbag_cmd_open_device(ratbag, path);
|
device = ratbag_cmd_open_device(ratbag, path);
|
||||||
if (device) {
|
if (device) {
|
||||||
printf("%s:\t%s\n", path, ratbag_device_get_name(device));
|
printf("%s:\t%s\n", path, ratbag_device_get_name(device));
|
||||||
device = ratbag_device_unref(device);
|
ratbag_device_unref(device);
|
||||||
supported++;
|
supported++;
|
||||||
}
|
}
|
||||||
free(input_list[i]);
|
free(input_list[i]);
|
||||||
@@ -1552,7 +1560,7 @@ ratbag_cmd_led_set_color(const struct ratbag_cmd *cmd,
|
|||||||
struct ratbag_led *led;
|
struct ratbag_led *led;
|
||||||
struct ratbag_color color;
|
struct ratbag_color color;
|
||||||
int rc;
|
int rc;
|
||||||
char red[2], green[2], blue[2];
|
char red[3], green[3], blue[3];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
@@ -2038,8 +2046,10 @@ main(int argc, char **argv)
|
|||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
static struct option opts[] = {
|
static struct option opts[] = {
|
||||||
{ "verbose", 2, 0, OPT_VERBOSE },
|
{ "verbose", optional_argument, 0, OPT_VERBOSE },
|
||||||
{ "help", 0, 0, OPT_HELP },
|
{ "version", no_argument, 0, OPT_VERSION },
|
||||||
|
{ "help", no_argument, 0, OPT_HELP },
|
||||||
|
{ 0, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
c = getopt_long(argc, argv, "+h", opts, &option_index);
|
c = getopt_long(argc, argv, "+h", opts, &option_index);
|
||||||
@@ -2050,6 +2060,9 @@ main(int argc, char **argv)
|
|||||||
case OPT_HELP:
|
case OPT_HELP:
|
||||||
usage();
|
usage();
|
||||||
goto out;
|
goto out;
|
||||||
|
case OPT_VERSION:
|
||||||
|
version();
|
||||||
|
goto out;
|
||||||
case OPT_VERBOSE:
|
case OPT_VERBOSE:
|
||||||
if (optarg && streq(optarg, "raw"))
|
if (optarg && streq(optarg, "raw"))
|
||||||
options.flags |= FLAG_VERBOSE_RAW;
|
options.flags |= FLAG_VERBOSE_RAW;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user