From adf9e9ed6c92cbcbe269f6a766aabbccdf827672 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 3 Dec 2016 11:35:59 +0100 Subject: [PATCH] libusbhid: Remove some unneeded compat code. --- lib/libu4bhid/Makefile | 4 --- lib/libu4bhid/descr.c | 20 ++---------- lib/libu4bhid/descr_compat.c | 78 -------------------------------------------- lib/libu4bhid/usbvar.h | 6 ---- 4 files changed, 2 insertions(+), 106 deletions(-) delete mode 100644 lib/libu4bhid/descr_compat.c diff --git a/lib/libu4bhid/Makefile b/lib/libu4bhid/Makefile index a1e717597c..d6fc801859 100644 --- a/lib/libu4bhid/Makefile +++ b/lib/libu4bhid/Makefile @@ -21,10 +21,6 @@ MLINKS= usbhid.3 libusbhid.3 usbhid.3 hid_get_report_desc.3 \ usbhid.3 hid_use_report_desc.3 SRCS= descr.c parse.c usage.c data.c - -# only when HID_COMPAT7 (FreeBSD 7 compat) -#SRCS+= descr_compat.c - INCS= usbhid.h .if defined(COMPAT_32BIT) diff --git a/lib/libu4bhid/descr.c b/lib/libu4bhid/descr.c index 49c0be195a..ccf31494a1 100644 --- a/lib/libu4bhid/descr.c +++ b/lib/libu4bhid/descr.c @@ -47,10 +47,6 @@ hid_set_immed(int fd, int enable) { int ret; ret = ioctl(fd, USB_SET_IMMED, &enable); -#ifdef HID_COMPAT7 - if (ret < 0) - ret = hid_set_immed_compat7(fd, enable); -#endif return (ret); } @@ -82,12 +78,7 @@ hid_get_report_id(int fd) use_ioctl: ret = ioctl(fd, USB_GET_REPORT_ID, &temp); -#ifdef HID_COMPAT7 - if (ret < 0) - ret = hid_get_report_id_compat7(fd); - else -#endif - ret = temp; + ret = temp; return (ret); } @@ -104,15 +95,8 @@ hid_get_report_desc(int fd) /* get actual length first */ ugd.ugd_data = hid_pass_ptr(NULL); ugd.ugd_maxlen = 65535; - if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { -#ifdef HID_COMPAT7 - /* could not read descriptor */ - /* try FreeBSD 7 compat code */ - return (hid_get_report_desc_compat7(fd)); -#else + if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) return (NULL); -#endif - } /* * NOTE: The kernel will return a failure if diff --git a/lib/libu4bhid/descr_compat.c b/lib/libu4bhid/descr_compat.c deleted file mode 100644 index e5f255cd45..0000000000 --- a/lib/libu4bhid/descr_compat.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: head/lib/libusbhid/descr_compat.c 188945 2009-02-23 18:36:54Z thompsa $ - */ - -/* - * This file contains fallback-compatibility code for the old FreeBSD - * USB stack. - */ -#ifdef HID_COMPAT7 - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "usbhid.h" -#include "usbvar.h" - -int -hid_set_immed_compat7(int fd, int enable) -{ - return (ioctl(fd, USB_SET_IMMED, &enable)); -} - -int -hid_get_report_id_compat7(int fd) -{ - int temp = -1; - - if (ioctl(fd, USB_GET_REPORT_ID, &temp) < 0) - return (-1); - - return (temp); -} - -report_desc_t -hid_get_report_desc_compat7(int fd) -{ - struct usb_ctl_report_desc rep; - - rep.ucrd_size = 0; - if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0) - return (NULL); - - return (hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size)); -} -#endif /* HID_COMPAT7 */ diff --git a/lib/libu4bhid/usbvar.h b/lib/libu4bhid/usbvar.h index 38d1805fef..706cd84c3e 100644 --- a/lib/libu4bhid/usbvar.h +++ b/lib/libu4bhid/usbvar.h @@ -39,12 +39,6 @@ struct report_desc { /* internal backwards compatibility functions */ -#ifdef HID_COMPAT7 -int hid_set_immed_compat7(int fd, int enable); -int hid_get_report_id_compat7(int fd); -report_desc_t hid_get_report_desc_compat7(int fd); -#endif - #ifdef COMPAT_32BIT #define hid_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) #else -- 2.11.4.GIT