Add first implementation of etekcity

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2015-08-14 14:37:21 -04:00
parent ca4af6f359
commit f5474cf9ec
4 changed files with 51 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ include_HEADERS = \
libratbag.h
libratbag_la_SOURCES = \
etekcity.c \
libratbag.c \
libratbag.h \
libratbag-util.c \

43
src/etekcity.c Normal file
View File

@@ -0,0 +1,43 @@
/*
* Copyright © 2015 Red Hat, Inc.
*
* 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.
*/
#include "config.h"
#include <linux/input.h>
#include <stdlib.h>
#include "libratbag-private.h"
static const struct ratbag_id etekcity_table[] = {
{.id = { .bustype = BUS_USB,
.vendor = USB_VENDOR_ID_ETEKCITY,
.product = USB_DEVICE_ID_ETEKCITY_SCROLL_ALPHA,
.version = VERSION_ANY },
},
{ },
};
struct ratbag_driver etekcity_driver = {
.name = "EtekCity",
.table_ids = etekcity_table,
};

View File

@@ -29,6 +29,8 @@
#include "libratbag.h"
#include "libratbag-util.h"
#define USB_VENDOR_ID_ETEKCITY 0x1ea7
#define USB_DEVICE_ID_ETEKCITY_SCROLL_ALPHA 0x4011
#define BUS_ANY 0xffff
#define VENDOR_ANY 0xffff
@@ -74,5 +76,8 @@ void log_msg(struct libratbag *libratbag,
#define log_bug_libratbag(li_, ...) log_msg((li_), LIBRATBAG_LOG_PRIORITY_ERROR, "libratbag bug: " __VA_ARGS__)
#define log_bug_client(li_, ...) log_msg((li_), LIBRATBAG_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__)
/* list of all supported drivers */
struct ratbag_driver etekcity_driver;
#endif /* LIBRATBAG_PRIVATE_H */

View File

@@ -194,6 +194,8 @@ libratbag_create_context(void)
libratbag->log_handler = libratbag_default_log_func;
libratbag->log_priority = LIBRATBAG_LOG_PRIORITY_DEBUG;
ratbag_register_driver(libratbag, &etekcity_driver);
return libratbag;
}