Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 2021 23:07:32 +0000 (UTC)
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r565272 - in head/sysutils: . hid-tools hid-tools/files
Message-ID:  <202102142307.11EN7WC0017434@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wulf (src committer)
Date: Sun Feb 14 23:07:31 2021
New Revision: 565272
URL: https://svnweb.freebsd.org/changeset/ports/565272

Log:
  new port: sysutils/hid-tools
  
  sysutils/hid-tools: Python scripts to manipulate HID data
  
  PR:		253498
  Approved by:	lwhsu (ports)

Added:
  head/sysutils/hid-tools/
  head/sysutils/hid-tools/Makefile   (contents, props changed)
  head/sysutils/hid-tools/distinfo   (contents, props changed)
  head/sysutils/hid-tools/files/
  head/sysutils/hid-tools/files/patch-hidtools_hidraw.py   (contents, props changed)
  head/sysutils/hid-tools/files/patch-man_hid-decode.md   (contents, props changed)
  head/sysutils/hid-tools/pkg-descr   (contents, props changed)
Modified:
  head/sysutils/Makefile

Modified: head/sysutils/Makefile
==============================================================================
--- head/sysutils/Makefile	Sun Feb 14 22:50:42 2021	(r565271)
+++ head/sysutils/Makefile	Sun Feb 14 23:07:31 2021	(r565272)
@@ -482,6 +482,7 @@
     SUBDIR += hexyl
     SUBDIR += hfsexplorer
     SUBDIR += hfsutils
+    SUBDIR += hid-tools
     SUBDIR += highlnk
     SUBDIR += hilite
     SUBDIR += host-setup

Added: head/sysutils/hid-tools/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hid-tools/Makefile	Sun Feb 14 23:07:31 2021	(r565272)
@@ -0,0 +1,33 @@
+# Created by: Vladimir Kondratyev <wulf@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	hid-tools
+PORTVERSION=	0.2
+CATEGORIES=	sysutils python
+MASTER_SITES=	https://gitlab.freedesktop.org/libevdev/${PORTNAME}/-/archive/${DISTVERSION}/
+
+MAINTAINER=	wulf@FreeBSD.org
+COMMENT=	Python scripts to manipulate HID data
+
+LICENSE=	GPLv2
+
+IGNORE_FreeBSD_11=	Is missing a hidraw(4) driver
+
+RUN_DEPENDS_FreeBSD_12=	iichid>=0.0.6:sysutils/iichid
+RUN_DEPENDS=		${PYTHON_PKGNAMEPREFIX}click>=0:devel/py-click@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}parse>=0:textproc/py-parse@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}pyudev>=0:devel/py-pyudev@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}yaml>=0:devel/py-yaml@${PY_FLAVOR} \
+			${RUN_DEPENDS_${OPSYS}_${OSREL:R}}
+
+USES=		python:3.6+ shebangfix tar:bz2
+USE_PYTHON=	autoplist distutils
+
+OPTIONS_DEFINE=		MANPAGES
+OPTIONS_DEFAULT=	MANPAGES
+
+MANPAGES_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pypandoc>=0:textproc/py-pypandoc@${PY_FLAVOR}
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>

Added: head/sysutils/hid-tools/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hid-tools/distinfo	Sun Feb 14 23:07:31 2021	(r565272)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1612900435
+SHA256 (hid-tools-0.2.tar.bz2) = c0a963f75699d69740ecd10549f3ffe32d620703f3090c5e3c55b9af1d469786
+SIZE (hid-tools-0.2.tar.bz2) = 78530

Added: head/sysutils/hid-tools/files/patch-hidtools_hidraw.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hid-tools/files/patch-hidtools_hidraw.py	Sun Feb 14 23:07:31 2021	(r565272)
@@ -0,0 +1,58 @@
+Fix ioctl(2) definitions to match <sys/ioccom.h> and <dev/hid/hidraw.h>
+
+--- hidtools/hidraw.py.orig	2019-03-29 01:29:29 UTC
++++ hidtools/hidraw.py
+@@ -36,13 +36,14 @@ def _ioctl(fd, EVIOC, code, return_type, buf=None):
+ 
+ 
+ # extracted from <asm-generic/ioctl.h>
+-_IOC_WRITE = 1
++_IOC_VOID = 1
+ _IOC_READ = 2
++_IOC_WRITE = 4
+ 
+ _IOC_NRBITS = 8
+ _IOC_TYPEBITS = 8
+-_IOC_SIZEBITS = 14
+-_IOC_DIRBITS = 2
++_IOC_SIZEBITS = 13
++_IOC_DIRBITS = 3
+ 
+ _IOC_NRSHIFT = 0
+ _IOC_TYPESHIFT = _IOC_NRSHIFT + _IOC_NRBITS
+@@ -74,7 +75,7 @@ def _IOW(type, nr, size):
+ 
+ # define HIDIOCGRDESCSIZE	_IOR('H', 0x01, int)
+ def _IOC_HIDIOCGRDESCSIZE(none, len):
+-    return _IOR('H', 0x01, len)
++    return _IOR('U', 30, len)
+ 
+ 
+ def _HIDIOCGRDESCSIZE(fd):
+@@ -85,7 +86,7 @@ def _HIDIOCGRDESCSIZE(fd):
+ 
+ # define HIDIOCGRDESC		_IOR('H', 0x02, struct hidraw_report_descriptor)
+ def _IOC_HIDIOCGRDESC(none, len):
+-    return _IOR('H', 0x02, len)
++    return _IOC(_IOC_VOID, 'U', 31, 0)
+ 
+ 
+ def _HIDIOCGRDESC(fd, size):
+@@ -102,7 +103,7 @@ def _HIDIOCGRDESC(fd, size):
+ 
+ # define HIDIOCGRAWINFO		_IOR('H', 0x03, struct hidraw_devinfo)
+ def _IOC_HIDIOCGRAWINFO(none, len):
+-    return _IOR('H', 0x03, len)
++    return _IOR('U', 32, len)
+ 
+ 
+ def _HIDIOCGRAWINFO(fd):
+@@ -113,7 +114,7 @@ def _HIDIOCGRAWINFO(fd):
+ 
+ # define HIDIOCGRAWNAME(len)     _IOC(_IOC_READ, 'H', 0x04, len)
+ def _IOC_HIDIOCGRAWNAME(none, len):
+-    return _IOC(_IOC_READ, 'H', 0x04, len)
++    return _IOC(_IOC_READ, 'U', 33, len)
+ 
+ 
+ def _HIDIOCGRAWNAME(fd):

Added: head/sysutils/hid-tools/files/patch-man_hid-decode.md
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hid-tools/files/patch-man_hid-decode.md	Sun Feb 14 23:07:31 2021	(r565272)
@@ -0,0 +1,25 @@
+Remove unsupported sysfs-dependent parts from manpage.
+
+--- man/hid-decode.md.orig	2019-03-29 01:29:29 UTC
++++ man/hid-decode.md
+@@ -11,8 +11,6 @@ SYNOPSIS
+ 
+ **hid-decode** */dev/hidraw0*
+ 
+-**hid-decode** */dev/input/event0*
+-
+ **hid-decode** *hid-recording*
+ 
+ DESCRIPTION
+@@ -20,11 +18,8 @@ DESCRIPTION
+ **hid-decode** decodes one or more HID report descriptors into into
+ human-readable format. It supports a variety of inputs:
+ 
+-- a binary format as exported in sysfs, e.g.
+-  _/sys/class/input/event0/device/device/report_descriptor_
+ - the format exported by **hid-recorder(1)**
+ - a _/dev/hidraw_ node
+-- a _/dev/input/event_ node
+ 
+ The format is deduced based on the input arguments. Undetected formats are
+ assumed to be binary files.

Added: head/sysutils/hid-tools/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hid-tools/pkg-descr	Sun Feb 14 23:07:31 2021	(r565272)
@@ -0,0 +1,16 @@
+hid-tools is a set of tools to interact with the kernel's HID subsystem.
+
+hid-recorder prints the HID Report Descriptor from a /dev/hidraw device
+node and any HID reports coming from that device.  The output format can
+be used with hid-replay for debugging.
+
+hid-replay takes the output from hid-recorder and replays it through a
+virtual HID device that looks exactly like the one recorded.
+
+hid-decode takes a HID Report Descriptor and prints a human-readable
+version of it.  hid-decode takes binary report descriptors, strings of
+bytes, and other formats.
+
+hid-tools requires hidraw.ko driver to be loaded in to kernel.
+
+WWW: https://gitlab.freedesktop.org/libevdev/hid-tools



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102142307.11EN7WC0017434>