summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Kondrashov <spbnick@gmail.com>2010-08-19 20:46:30 +0400
committerNikolai Kondrashov <spbnick@gmail.com>2010-08-19 20:51:34 +0400
commit490ac2a5fc080ecc6daeef60117e65143013d4d1 (patch)
tree97ec6dafa703adf104ebd354932ab3891feecb1f
parentfaa5530291e9799acca48cda59e8ce94c1a7d354 (diff)
downloadusbhid-dump-490ac2a5fc080ecc6daeef60117e65143013d4d1.tar.gz
Renamed the package from hid-dump to usbhid-dump
In preparation for integration with usbutils, the package is given a more globally correct name "usbhid-dump". All the relevant directories and files are renamed. All the relevant symbols in the code are renamed. The resulting binary is renamed. All the license notices in the files are updated with the new name.
-rw-r--r--Makefile.am8
-rwxr-xr-xbootstrap8
-rw-r--r--configure.ac12
-rw-r--r--include/Makefile.am10
-rw-r--r--include/usbhid_dump/.gitignore (renamed from include/hid_dump/.gitignore)0
-rw-r--r--include/usbhid_dump/Makefile.am (renamed from include/hid_dump/Makefile.am)8
-rw-r--r--include/usbhid_dump/iface.h (renamed from include/hid_dump/iface.h)78
-rw-r--r--include/usbhid_dump/libusb.h (renamed from include/hid_dump/libusb.h)16
-rw-r--r--include/usbhid_dump/str.h (renamed from include/hid_dump/str.h)19
-rw-r--r--lib/Makefile.am12
-rw-r--r--lib/iface.c106
-rw-r--r--lib/libusb.c12
-rw-r--r--lib/str.c14
-rw-r--r--src/.gitignore2
-rw-r--r--src/Makefile.am14
-rw-r--r--src/usbhid-dump.c (renamed from src/hid-dump.c)83
16 files changed, 204 insertions, 198 deletions
diff --git a/Makefile.am b/Makefile.am
index 1f54ce3..56f6298 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,19 +1,19 @@
# Copyright (C) 2009-2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SUBDIRS = include lib src
diff --git a/bootstrap b/bootstrap
index c756f4b..b3f8128 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,20 +2,20 @@
#
# Copyright (c) 2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Fail on any error
diff --git a/configure.ac b/configure.ac
index 79716eb..abe945e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,26 +1,26 @@
#
# Copyright (C) 2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([hid-dump], [1.0])
+AC_INIT([usbhid-dump], [1.0])
AC_CONFIG_AUX_DIR([auxdir])
AM_INIT_AUTOMAKE([1.9 -Wall foreign])
AC_CONFIG_HEADER([config.h])
@@ -92,7 +92,7 @@ fi
#
AC_CONFIG_FILES([Makefile
include/Makefile
- include/hid_dump/Makefile
+ include/usbhid_dump/Makefile
lib/Makefile
src/Makefile])
AC_OUTPUT
diff --git a/include/Makefile.am b/include/Makefile.am
index ae68d12..beae392 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,19 +1,19 @@
# Copyright (C) 2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SUBDIRS = hid_dump
+SUBDIRS = usbhid_dump
diff --git a/include/hid_dump/.gitignore b/include/usbhid_dump/.gitignore
index 9ee6454..9ee6454 100644
--- a/include/hid_dump/.gitignore
+++ b/include/usbhid_dump/.gitignore
diff --git a/include/hid_dump/Makefile.am b/include/usbhid_dump/Makefile.am
index 262dabb..71d6e8c 100644
--- a/include/hid_dump/Makefile.am
+++ b/include/usbhid_dump/Makefile.am
@@ -1,19 +1,19 @@
# Copyright (C) 2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
noinst_HEADERS = \
diff --git a/include/hid_dump/iface.h b/include/usbhid_dump/iface.h
index 35ad615..8bd591a 100644
--- a/include/hid_dump/iface.h
+++ b/include/usbhid_dump/iface.h
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - interface
+ * @brief usbhid-dump - interface
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,8 +24,8 @@
* @(#) $Id$
*/
-#ifndef __HID_DUMP_IFACE_H__
-#define __HID_DUMP_IFACE_H__
+#ifndef __USBHID_DUMP_IFACE_H__
+#define __USBHID_DUMP_IFACE_H__
#include <stdbool.h>
#include <libusb-1.0/libusb.h>
@@ -34,10 +34,10 @@
extern "C" {
#endif
-typedef struct hid_dump_iface hid_dump_iface;
+typedef struct usbhid_dump_iface usbhid_dump_iface;
-struct hid_dump_iface {
- hid_dump_iface *next;
+struct usbhid_dump_iface {
+ usbhid_dump_iface *next;
libusb_device_handle *handle; /**< Device handle */
uint8_t number; /**< Interface number */
uint8_t int_in_ep_addr; /**< Interrupt IN EP address */
@@ -59,27 +59,27 @@ struct hid_dump_iface {
for the interface */
};
-extern bool hid_dump_iface_valid(const hid_dump_iface *iface);
+extern bool usbhid_dump_iface_valid(const usbhid_dump_iface *iface);
-extern hid_dump_iface *hid_dump_iface_new(
+extern usbhid_dump_iface *usbhid_dump_iface_new(
libusb_device_handle *handle,
uint8_t number,
uint8_t int_in_ep_addr,
uint16_t int_in_ep_maxp);
-extern void hid_dump_iface_free(hid_dump_iface *iface);
+extern void usbhid_dump_iface_free(usbhid_dump_iface *iface);
-extern bool hid_dump_iface_list_valid(const hid_dump_iface *list);
+extern bool usbhid_dump_iface_list_valid(const usbhid_dump_iface *list);
static inline bool
-hid_dump_iface_list_empty(const hid_dump_iface *list)
+usbhid_dump_iface_list_empty(const usbhid_dump_iface *list)
{
return list == NULL;
}
-extern size_t hid_dump_iface_list_len(const hid_dump_iface *list);
+extern size_t usbhid_dump_iface_list_len(const usbhid_dump_iface *list);
-extern void hid_dump_iface_list_free(hid_dump_iface *list);
+extern void usbhid_dump_iface_list_free(usbhid_dump_iface *list);
/**
@@ -91,8 +91,8 @@ extern void hid_dump_iface_list_free(hid_dump_iface *list);
* @return Libusb error code.
*/
enum libusb_error
-hid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
- hid_dump_iface **plist);
+usbhid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
+ usbhid_dump_iface **plist);
/**
* Filter an interface list by an optional interface number, resulting
@@ -104,9 +104,9 @@ hid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
*
* @return The resulting list head
*/
-extern hid_dump_iface *hid_dump_iface_list_fltr_by_num(
- hid_dump_iface *list,
- int number);
+extern usbhid_dump_iface *usbhid_dump_iface_list_fltr_by_num(
+ usbhid_dump_iface *list,
+ int number);
/**
* Detach all interfaces in a list from their kernel drivers (if any).
@@ -115,7 +115,8 @@ extern hid_dump_iface *hid_dump_iface_list_fltr_by_num(
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_detach(hid_dump_iface *list);
+extern enum libusb_error usbhid_dump_iface_list_detach(
+ usbhid_dump_iface *list);
/**
* Attach all interfaces in a list to their kernel drivers (if were detached
@@ -125,7 +126,8 @@ extern enum libusb_error hid_dump_iface_list_detach(hid_dump_iface *list);
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_attach(hid_dump_iface *list);
+extern enum libusb_error usbhid_dump_iface_list_attach(
+ usbhid_dump_iface *list);
/**
* Claim all interfaces in a list.
@@ -134,7 +136,8 @@ extern enum libusb_error hid_dump_iface_list_attach(hid_dump_iface *list);
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_claim(hid_dump_iface *list);
+extern enum libusb_error usbhid_dump_iface_list_claim(
+ usbhid_dump_iface *list);
/**
* Set idle duration on all interfaces in a list; ignore errors indicating
@@ -146,10 +149,10 @@ extern enum libusb_error hid_dump_iface_list_claim(hid_dump_iface *list);
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_set_idle(
- const hid_dump_iface *list,
- uint8_t duration,
- unsigned int timeout);
+extern enum libusb_error usbhid_dump_iface_list_set_idle(
+ const usbhid_dump_iface *list,
+ uint8_t duration,
+ unsigned int timeout);
/**
* Set HID protocol on all interfaces in a list; ignore errors indicating
@@ -161,10 +164,10 @@ extern enum libusb_error hid_dump_iface_list_set_idle(
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_set_protocol(
- const hid_dump_iface *list,
- bool report,
- unsigned int timeout);
+extern enum libusb_error usbhid_dump_iface_list_set_protocol(
+ const usbhid_dump_iface *list,
+ bool report,
+ unsigned int timeout);
/**
* Clear halt condition on input interrupt endpoints of all interfaces.
@@ -173,8 +176,8 @@ extern enum libusb_error hid_dump_iface_list_set_protocol(
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_clear_halt(
- hid_dump_iface *list);
+extern enum libusb_error usbhid_dump_iface_list_clear_halt(
+ usbhid_dump_iface *list);
/**
* Release all interfaces in a list (if were claimed before).
*
@@ -182,10 +185,11 @@ extern enum libusb_error hid_dump_iface_list_clear_halt(
*
* @return Libusb error code.
*/
-extern enum libusb_error hid_dump_iface_list_release(hid_dump_iface *list);
+extern enum libusb_error usbhid_dump_iface_list_release(
+ usbhid_dump_iface *list);
#ifdef __cplusplus
} /* extern "C" */
#endif
-#endif /* __HID_DUMP_IFACE_H__ */
+#endif /* __USBHID_DUMP_IFACE_H__ */
diff --git a/include/hid_dump/libusb.h b/include/usbhid_dump/libusb.h
index 842ba15..91ad476 100644
--- a/include/hid_dump/libusb.h
+++ b/include/usbhid_dump/libusb.h
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - libusb API extensions
+ * @brief usbhid-dump - libusb API extensions
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,8 +24,8 @@
* @(#) $Id$
*/
-#ifndef __HID_DUMP_LIBUSB_H__
-#define __HID_DUMP_LIBUSB_H__
+#ifndef __USBHID_DUMP_LIBUSB_H__
+#define __USBHID_DUMP_LIBUSB_H__
#include <libusb-1.0/libusb.h>
@@ -45,4 +45,4 @@ extern enum libusb_error libusb_open_device_with_bus_dev(
} /* extern "C" */
#endif
-#endif /* __HID_DUMP_LIBUSB_H__ */
+#endif /* __USBHID_DUMP_LIBUSB_H__ */
diff --git a/include/hid_dump/str.h b/include/usbhid_dump/str.h
index 45f741e..14d00eb 100644
--- a/include/hid_dump/str.h
+++ b/include/usbhid_dump/str.h
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - string utilities
+ * @brief usbhid-dump - string utilities
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,8 +24,8 @@
* @(#) $Id$
*/
-#ifndef __HID_DUMP_STR_H__
-#define __HID_DUMP_STR_H__
+#ifndef __USBHID_DUMP_STR_H__
+#define __USBHID_DUMP_STR_H__
#include <stdbool.h>
@@ -33,11 +33,10 @@
extern "C" {
#endif
-extern bool hid_dump_strisblank(const char *str);
+extern bool usbhid_dump_strisblank(const char *str);
#ifdef __cplusplus
} /* extern "C" */
#endif
-#endif /* __HID_DUMP_STR_H__ */
-
+#endif /* __USBHID_DUMP_STR_H__ */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1d31032..89f56cd 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,24 +1,24 @@
# Copyright (C) 2009-2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-noinst_LTLIBRARIES = libhid_dump.la
+noinst_LTLIBRARIES = libusbhid_dump.la
-libhid_dump_la_SOURCES = \
+libusbhid_dump_la_SOURCES = \
iface.c \
libusb.c \
str.c
diff --git a/lib/iface.c b/lib/iface.c
index 1f1a7b0..573d760 100644
--- a/lib/iface.c
+++ b/lib/iface.c
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - interface
+ * @brief usbhid-dump - interface
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,26 +24,26 @@
* @(#) $Id$
*/
-#include "hid_dump/iface.h"
+#include "usbhid_dump/iface.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
bool
-hid_dump_iface_valid(const hid_dump_iface *iface)
+usbhid_dump_iface_valid(const usbhid_dump_iface *iface)
{
return iface != NULL &&
iface->handle != NULL &&
iface->number < UINT8_MAX;
}
-hid_dump_iface *
-hid_dump_iface_new(libusb_device_handle *handle,
- uint8_t number,
- uint8_t int_in_ep_addr,
- uint16_t int_in_ep_maxp)
+usbhid_dump_iface *
+usbhid_dump_iface_new(libusb_device_handle *handle,
+ uint8_t number,
+ uint8_t int_in_ep_addr,
+ uint16_t int_in_ep_maxp)
{
- hid_dump_iface *iface;
+ usbhid_dump_iface *iface;
iface = malloc(sizeof(*iface));
if (iface == NULL)
@@ -63,22 +63,22 @@ hid_dump_iface_new(libusb_device_handle *handle,
void
-hid_dump_iface_free(hid_dump_iface *iface)
+usbhid_dump_iface_free(usbhid_dump_iface *iface)
{
if (iface == NULL)
return;
- assert(hid_dump_iface_valid(iface));
+ assert(usbhid_dump_iface_valid(iface));
free(iface);
}
bool
-hid_dump_iface_list_valid(const hid_dump_iface *list)
+usbhid_dump_iface_list_valid(const usbhid_dump_iface *list)
{
for (; list != NULL; list = list->next)
- if (!hid_dump_iface_valid(list))
+ if (!usbhid_dump_iface_valid(list))
return false;
return true;
@@ -86,7 +86,7 @@ hid_dump_iface_list_valid(const hid_dump_iface *list)
size_t
-hid_dump_iface_list_len(const hid_dump_iface *list)
+usbhid_dump_iface_list_len(const usbhid_dump_iface *list)
{
size_t len = 0;
@@ -98,21 +98,21 @@ hid_dump_iface_list_len(const hid_dump_iface *list)
void
-hid_dump_iface_list_free(hid_dump_iface *list)
+usbhid_dump_iface_list_free(usbhid_dump_iface *list)
{
- hid_dump_iface *next;
+ usbhid_dump_iface *next;
for (; list != NULL; list = next)
{
next = list->next;
- hid_dump_iface_free(list);
+ usbhid_dump_iface_free(list);
}
}
enum libusb_error
-hid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
- hid_dump_iface **plist)
+usbhid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
+ usbhid_dump_iface **plist)
{
enum libusb_error err = LIBUSB_ERROR_OTHER;
@@ -121,9 +121,9 @@ hid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
const struct libusb_endpoint_descriptor *ep_list;
uint8_t ep_num;
const struct libusb_endpoint_descriptor *ep;
- hid_dump_iface *list = NULL;
- hid_dump_iface *last = NULL;
- hid_dump_iface *iface;
+ usbhid_dump_iface *list = NULL;
+ usbhid_dump_iface *last = NULL;
+ usbhid_dump_iface *iface;
assert(handle != NULL);
@@ -153,7 +153,7 @@ hid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
LIBUSB_ENDPOINT_IN)
continue;
- iface = hid_dump_iface_new(
+ iface = usbhid_dump_iface_new(
handle,
libusb_iface->altsetting->bInterfaceNumber,
ep->bEndpointAddress, ep->wMaxPacketSize);
@@ -182,7 +182,7 @@ hid_dump_iface_list_new_from_dev(libusb_device_handle *handle,
cleanup:
- hid_dump_iface_list_free(list);
+ usbhid_dump_iface_list_free(list);
if (config != NULL)
libusb_free_config_descriptor(config);
@@ -191,15 +191,15 @@ cleanup:
}
-hid_dump_iface *
-hid_dump_iface_list_fltr_by_num(hid_dump_iface *list,
- int number)
+usbhid_dump_iface *
+usbhid_dump_iface_list_fltr_by_num(usbhid_dump_iface *list,
+ int number)
{
- hid_dump_iface *prev;
- hid_dump_iface *iface;
- hid_dump_iface *next;
+ usbhid_dump_iface *prev;
+ usbhid_dump_iface *iface;
+ usbhid_dump_iface *next;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
assert(number < UINT8_MAX);
if (number < 0)
@@ -225,11 +225,11 @@ hid_dump_iface_list_fltr_by_num(hid_dump_iface *list,
enum libusb_error
-hid_dump_iface_list_detach(hid_dump_iface *list)
+usbhid_dump_iface_list_detach(usbhid_dump_iface *list)
{
enum libusb_error err;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
{
@@ -245,11 +245,11 @@ hid_dump_iface_list_detach(hid_dump_iface *list)
enum libusb_error
-hid_dump_iface_list_attach(hid_dump_iface *list)
+usbhid_dump_iface_list_attach(usbhid_dump_iface *list)
{
enum libusb_error err;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
if (list->detached)
@@ -265,11 +265,11 @@ hid_dump_iface_list_attach(hid_dump_iface *list)
enum libusb_error
-hid_dump_iface_list_claim(hid_dump_iface *list)
+usbhid_dump_iface_list_claim(usbhid_dump_iface *list)
{
enum libusb_error err;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
{
@@ -285,11 +285,11 @@ hid_dump_iface_list_claim(hid_dump_iface *list)
enum libusb_error
-hid_dump_iface_list_clear_halt(hid_dump_iface *list)
+usbhid_dump_iface_list_clear_halt(usbhid_dump_iface *list)
{
enum libusb_error err;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
{
@@ -303,13 +303,13 @@ hid_dump_iface_list_clear_halt(hid_dump_iface *list)
enum libusb_error
-hid_dump_iface_list_set_idle(const hid_dump_iface *list,
- uint8_t duration,
- unsigned int timeout)
+usbhid_dump_iface_list_set_idle(const usbhid_dump_iface *list,
+ uint8_t duration,
+ unsigned int timeout)
{
int rc;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
{
@@ -338,13 +338,13 @@ hid_dump_iface_list_set_idle(const hid_dump_iface *list,
enum libusb_error
-hid_dump_iface_list_set_protocol(const hid_dump_iface *list,
- bool report,
- unsigned int timeout)
+usbhid_dump_iface_list_set_protocol(const usbhid_dump_iface *list,
+ bool report,
+ unsigned int timeout)
{
int rc;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
{
@@ -373,11 +373,11 @@ hid_dump_iface_list_set_protocol(const hid_dump_iface *list,
enum libusb_error
-hid_dump_iface_list_release(hid_dump_iface *list)
+usbhid_dump_iface_list_release(usbhid_dump_iface *list)
{
enum libusb_error err;
- assert(hid_dump_iface_list_valid(list));
+ assert(usbhid_dump_iface_list_valid(list));
for (; list != NULL; list = list->next)
if (list->claimed)
diff --git a/lib/libusb.c b/lib/libusb.c
index ae3da9a..fae109b 100644
--- a/lib/libusb.c
+++ b/lib/libusb.c
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - libusb API extensions
+ * @brief usbhid-dump - libusb API extensions
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,7 +24,7 @@
* @(#) $Id$
*/
-#include "hid_dump/libusb.h"
+#include "usbhid_dump/libusb.h"
#include <stdbool.h>
const char *
diff --git a/lib/str.c b/lib/str.c
index 26e5fcf..ceff86d 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - string utilities
+ * @brief usbhid-dump - string utilities
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,11 +24,11 @@
* @(#) $Id$
*/
-#include "hid_dump/str.h"
+#include "usbhid_dump/str.h"
#include <ctype.h>
bool
-hid_dump_strisblank(const char *str)
+usbhid_dump_strisblank(const char *str)
{
for (; *str != '\0'; str++)
if (!isblank(*str))
diff --git a/src/.gitignore b/src/.gitignore
index 70ed147..8223adc 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,5 +1,5 @@
/Makefile.in
-/hid-dump
+/usbhid-dump
/.deps
/.libs
/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 04f1717..8ddc2c0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,22 +1,22 @@
# Copyright (C) 2010 Nikolai Kondrashov
#
-# This file is part of hid-dump.
+# This file is part of usbhid-dump.
#
-# Hid-dump is free software; you can redistribute it and/or modify
+# Usbhid-dump is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Hid-dump is distributed in the hope that it will be useful,
+# Usbhid-dump is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with hid-dump; if not, write to the Free Software
+# along with usbhid-dump; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-bin_PROGRAMS = hid-dump
+bin_PROGRAMS = usbhid-dump
-hid_dump_SOURCES = hid-dump.c
-hid_dump_LDADD = ../lib/libhid_dump.la
+usbhid_dump_SOURCES = usbhid-dump.c
+usbhid_dump_LDADD = ../lib/libusbhid_dump.la
diff --git a/src/hid-dump.c b/src/usbhid-dump.c
index a066408..fb1f74c 100644
--- a/src/hid-dump.c
+++ b/src/usbhid-dump.c
@@ -1,22 +1,22 @@
/** @file
- * @brief hid-dump - entry point
+ * @brief usbhid-dump - entry point
*
* Copyright (C) 2010 Nikolai Kondrashov
*
- * This file is part of hid-dump.
+ * This file is part of usbhid-dump.
*
- * Hid-dump is free software; you can redistribute it and/or modify
+ * Usbhid-dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Hid-dump is distributed in the hope that it will be useful,
+ * Usbhid-dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with hid-dump; if not, write to the Free Software
+ * along with usbhid-dump; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Nikolai Kondrashov <spbnick@gmail.com>
@@ -24,9 +24,9 @@
* @(#) $Id$
*/
-#include "hid_dump/iface.h"
-#include "hid_dump/str.h"
-#include "hid_dump/libusb.h"
+#include "usbhid_dump/iface.h"
+#include "usbhid_dump/str.h"
+#include "usbhid_dump/libusb.h"
#include <assert.h>
#include <stdbool.h>
@@ -177,12 +177,12 @@ dump(uint8_t iface_num,
static bool
-dump_iface_list_descriptor(const hid_dump_iface *list)
+dump_iface_list_descriptor(const usbhid_dump_iface *list)
{
- const hid_dump_iface *iface;
- uint8_t buf[MAX_DESCRIPTOR_SIZE];
- int rc;
- enum libusb_error err;
+ const usbhid_dump_iface *iface;
+ uint8_t buf[MAX_DESCRIPTOR_SIZE];
+ int rc;
+ enum libusb_error err;
for (iface = list; iface != NULL; iface = iface->next)
{
@@ -210,12 +210,12 @@ static void
dump_iface_list_stream_cb(struct libusb_transfer *transfer)
{
enum libusb_error err;
- hid_dump_iface *iface;
+ usbhid_dump_iface *iface;
assert(transfer != NULL);
- iface = (hid_dump_iface *)transfer->user_data;
- assert(hid_dump_iface_valid(iface));
+ iface = (usbhid_dump_iface *)transfer->user_data;
+ assert(usbhid_dump_iface_valid(iface));
/* Clear interface "has transfer submitted" flag */
iface->submitted = false;
@@ -257,28 +257,28 @@ dump_iface_list_stream_cb(struct libusb_transfer *transfer)
static bool
-dump_iface_list_stream(libusb_context *ctx, hid_dump_iface *list)
+dump_iface_list_stream(libusb_context *ctx, usbhid_dump_iface *list)
{
bool result = false;
enum libusb_error err;
size_t transfer_num = 0;
struct libusb_transfer **transfer_list = NULL;
struct libusb_transfer **ptransfer;
- hid_dump_iface *iface;
+ usbhid_dump_iface *iface;
bool submitted = false;
/* Set report protocol on all interfaces */
- err = hid_dump_iface_list_set_protocol(list, true, TIMEOUT);
+ err = usbhid_dump_iface_list_set_protocol(list, true, TIMEOUT);
if (err != LIBUSB_SUCCESS)
LIBUSB_ERROR_CLEANUP("set report protocol");
/* Set infinite idle duration on all interfaces */
- err = hid_dump_iface_list_set_idle(list, 0, TIMEOUT);
+ err = usbhid_dump_iface_list_set_idle(list, 0, TIMEOUT);
if (err != LIBUSB_SUCCESS)
LIBUSB_ERROR_CLEANUP("set infinite idle duration");
/* Calculate number of interfaces and thus transfers */
- transfer_num = hid_dump_iface_list_len(list);
+ transfer_num = usbhid_dump_iface_list_len(list);
/* Allocate transfer list */
transfer_list = malloc(sizeof(*transfer_list) * transfer_num);
@@ -341,7 +341,7 @@ dump_iface_list_stream(libusb_context *ctx, hid_dump_iface *list)
if (err != LIBUSB_SUCCESS)
LIBUSB_ERROR_CLEANUP("submit a transfer");
/* Set interface "has transfer submitted" flag */
- ((hid_dump_iface *)(*ptransfer)->user_data)->submitted = true;
+ ((usbhid_dump_iface *)(*ptransfer)->user_data)->submitted = true;
/* Set "have any submitted transfers" flag */
submitted = true;
}
@@ -360,7 +360,7 @@ dump_iface_list_stream(libusb_context *ctx, hid_dump_iface *list)
(size_t)(ptransfer - transfer_list) < transfer_num;
ptransfer++)
{
- iface = (hid_dump_iface *)(*ptransfer)->user_data;
+ iface = (usbhid_dump_iface *)(*ptransfer)->user_data;
if (iface != NULL && iface->submitted)
submitted = true;
@@ -383,7 +383,7 @@ cleanup:
(size_t)(ptransfer - transfer_list) < transfer_num;
ptransfer++)
{
- iface = (hid_dump_iface *)(*ptransfer)->user_data;
+ iface = (usbhid_dump_iface *)(*ptransfer)->user_data;
if (iface != NULL && iface->submitted)
{
@@ -393,7 +393,10 @@ cleanup:
else
{
LIBUSB_FAILURE("cancel a transfer, ignoring");
- /* XXX are we really sure the transfer won't be finished? */
+ /*
+ * XXX are we really sure
+ * the transfer won't be finished?
+ */
iface->submitted = false;
}
}
@@ -418,7 +421,7 @@ cleanup:
(size_t)(ptransfer - transfer_list) < transfer_num;
ptransfer++)
{
- iface = (hid_dump_iface *)(*ptransfer)->user_data;
+ iface = (usbhid_dump_iface *)(*ptransfer)->user_data;
if (iface != NULL && iface->submitted)
submitted = true;
@@ -435,7 +438,7 @@ cleanup:
(size_t)(ptransfer - transfer_list) < transfer_num;
ptransfer++)
{
- iface = (hid_dump_iface *)(*ptransfer)->user_data;
+ iface = (usbhid_dump_iface *)(*ptransfer)->user_data;
/*
* Only free a transfer if it is not submitted. Better leak some
@@ -463,7 +466,7 @@ run(bool dump_descriptor,
enum libusb_error err;
libusb_context *ctx = NULL;
libusb_device_handle *handle = NULL;
- hid_dump_iface *iface_list = NULL;
+ usbhid_dump_iface *iface_list = NULL;
/* Initialize libusb context */
err = libusb_init(&ctx);
@@ -479,23 +482,23 @@ run(bool dump_descriptor,
LIBUSB_FAILURE_CLEANUP("find and open the device");
/* Retrieve the list of HID interfaces from a device */
- err = hid_dump_iface_list_new_from_dev(handle, &iface_list);
+ err = usbhid_dump_iface_list_new_from_dev(handle, &iface_list);
if (err != LIBUSB_SUCCESS)
LIBUSB_FAILURE_CLEANUP("find a HID interface");
/* Filter the interface list by specified interface number */
- iface_list = hid_dump_iface_list_fltr_by_num(iface_list, iface_num);
- if (hid_dump_iface_list_empty(iface_list))
+ iface_list = usbhid_dump_iface_list_fltr_by_num(iface_list, iface_num);
+ if (usbhid_dump_iface_list_empty(iface_list))
ERROR_CLEANUP("No matching HID interfaces");
/* Detach interfaces */
- err = hid_dump_iface_list_detach(iface_list);
+ err = usbhid_dump_iface_list_detach(iface_list);
if (err != LIBUSB_SUCCESS)
LIBUSB_FAILURE_CLEANUP("detach the interface(s) from "
"the kernel drivers");
/* Claim interfaces */
- err = hid_dump_iface_list_claim(iface_list);
+ err = usbhid_dump_iface_list_claim(iface_list);
if (err != LIBUSB_SUCCESS)
LIBUSB_FAILURE_CLEANUP("claim the interface(s)");
@@ -508,17 +511,17 @@ run(bool dump_descriptor,
cleanup:
/* Release the interfaces back */
- err = hid_dump_iface_list_release(iface_list);
+ err = usbhid_dump_iface_list_release(iface_list);
if (err != LIBUSB_SUCCESS)
LIBUSB_FAILURE("release the interface(s)");
/* Attach interfaces back */
- err = hid_dump_iface_list_attach(iface_list);
+ err = usbhid_dump_iface_list_attach(iface_list);
if (err != LIBUSB_SUCCESS)
LIBUSB_FAILURE("attach the interface(s) to the kernel drivers");
/* Free the interface list */
- hid_dump_iface_list_free(iface_list);
+ usbhid_dump_iface_list_free(iface_list);
/* Free the device */
if (handle != NULL)
@@ -655,21 +658,21 @@ main(int argc, char **argv)
*/
errno = 0;
bus_num = strtol(bus_str, &end, 0);
- if (errno != 0 || !hid_dump_strisblank(end) ||
+ if (errno != 0 || !usbhid_dump_strisblank(end) ||
bus_num <= 0 || bus_num > 255)
USAGE_ERROR("Invalid bus number \"%s\"", bus_str);
errno = 0;
dev_num = strtol(dev_str, &end, 0);
- if (errno != 0 || !hid_dump_strisblank(end) ||
+ if (errno != 0 || !usbhid_dump_strisblank(end) ||
dev_num <= 0 || dev_num > 255)
USAGE_ERROR("Invalid device address \"%s\"", dev_str);
- if (!hid_dump_strisblank(if_str))
+ if (!usbhid_dump_strisblank(if_str))
{
errno = 0;
if_num = strtol(if_str, &end, 0);
- if (errno != 0 || !hid_dump_strisblank(end) ||
+ if (errno != 0 || !usbhid_dump_strisblank(end) ||
if_num < 0 || if_num >= 255)
USAGE_ERROR("Invalid interface number \"%s\"", if_str);
}