1
0
forked from drath/libratbag

Add a new header for PID/VIDs that we need to care about

Beats having the same #define in multiple places

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2016-04-28 14:51:39 +10:00
parent 40112e6061
commit b6294d4f93
4 changed files with 37 additions and 7 deletions

View File

@@ -19,7 +19,8 @@ libratbag_la_SOURCES = \
libratbag-hidraw.h \
libratbag-private.h \
libratbag-test.c \
libratbag-test.h
libratbag-test.h \
usb-ids.h
libratbag_la_LIBADD = \
libhidpp.la \
@@ -66,7 +67,8 @@ libhidpp_la_SOURCES = \
hidpp10.h \
hidpp10.c \
hidpp20.h \
hidpp20.c
hidpp20.c \
usb-ids.h
libhidpp_la_LDFLAGS = -lm
libutil_la_SOURCES = \
libratbag-util.c \

View File

@@ -35,8 +35,6 @@
#include "config.h"
#define USB_VENDOR_ID_LOGITECH 0x046d
#include <linux/types.h>
#include <errno.h>
#include <stdbool.h>
@@ -45,6 +43,7 @@
#include <unistd.h>
#include "hidpp10.h"
#include "usb-ids.h"
#include "libratbag-private.h"
#include "libratbag-hidraw.h"

View File

@@ -30,13 +30,13 @@
#include <sys/ioctl.h>
#include <linux/hidraw.h>
#include "usb-ids.h"
#include "hidpp10.h"
#include "libratbag-util.h"
#include "liblur.h"
#define _EXPORT_ __attribute__ ((visibility("default")))
#define MAX_DEVICES 6
#define VENDOR_ID_LOGITECH 0x046d
struct lur_receiver {
int refcount;
@@ -113,7 +113,7 @@ lur_device_disconnect(struct lur_device *dev)
_EXPORT_ int
lur_is_receiver(uint16_t vid, uint16_t pid)
{
return (vid == VENDOR_ID_LOGITECH && (pid == 0xc52b || pid == 0xc532));
return (vid == USB_VENDOR_ID_LOGITECH && (pid == 0xc52b || pid == 0xc532));
}
static bool
@@ -232,7 +232,7 @@ lur_receiver_enumerate(struct lur_receiver *lur,
lur_receiver_ref(lur);
dev->refcount = 1;
dev->name = strdup_safe(name);
dev->vid = VENDOR_ID_LOGITECH;
dev->vid = USB_VENDOR_ID_LOGITECH;
dev->pid = wpid;
dev->type = type;
dev->serial = serial;

29
src/usb-ids.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* Copyright © 2016 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef USB_IDS_H
#define USB_IDS_H
#define USB_VENDOR_ID_LOGITECH 0x046d
#endif