digimend / hidrd Goto Github PK
View Code? Open in Web Editor NEWHID report descriptor I/O library and conversion tool
License: GNU General Public License v2.0
HID report descriptor I/O library and conversion tool
License: GNU General Public License v2.0
I must have stared at
<usage_minimum>01</usage_minimum>
<usage_maximum>12</usage_maximum>
<report_count>12</report_count>
a dozen (decimal; i.e, 0x0c) times before realizing, from looking at the C code equivalent, that it is broken. Does it really make sense for usage elements to be represented in hexadecimal in XML? If so, could they be written as 0x12
or 12h
to make it clear to human readers that the values are hexadecimal? Or could there be a comment noting that fact?
For that matter, when reading XML, could numbers be self-describing? I.e., could 0x0c
, 0Ch
, and 12
all be considered equivalent representations of the same number? (Perhaps also 0b00001100
.)
(I realize that it would be tricky to do this in a fully backwards-compatible way.)
Not seeing any support for Auxiliary Display Page usage page for bitmapped displays,
see: https://www.usb.org/sites/default/files/hut1_2.pdf section 20.2.1
thank you for writing this repo, it made it very easy to write https://github.com/homespun/node-hid-parse
Hi Nikolai,
here are some autotools cleanups I had laying around: http://ao2.it/tmp/hidrd-autotools-cleanup.patch
You can apply the changes with git am
.
There are still a few warnings with the current build files:
include/hidrd/usage/Makefile.am:22: warning: '%'-style pattern rules are a GNU make extension
lib/usage/Makefile.am:31: warning: '%'-style pattern rules are a GNU make extension
I am not sure if these are worth fixing.
Ciao,
Antonio
After install the program:
./bootstrap
./configure
make
sudo make install
When I try to run the program, it can't find the libraries:
hidrd-convert: error while loading shared libraries: libhidrd_util.so.0: cannot open shared object file: No such file or directory
But I can verify the shared libraries is there:
$ find /usr/local/lib/* -name libhidrd_util.so*
/usr/local/lib/libhidrd_util.so
/usr/local/lib/libhidrd_util.so.0
/usr/local/lib/libhidrd_util.so.0.0.0
I have tested on Ubuntu 14.04 and 16.04:
$ uname -a
Linux hexiongjun-9020 4.4.0-96-generic #119~14.04.1-Ubuntu SMP Wed Sep 13 08:40:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$uname -a
Linux hexiongjun-vm 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
When I append the /usr/local/lib to the LD_LIBRARY_PATH env, the program would work fine.
Also, when running the make install, there're many warnings like this:
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
$ sudo cat /sys/kernel/debug/hid/0005:3820:0009.0008/rdesc | head -n1 | xxd -r -p | jhbuild run hidrd-convert -i natv -o xml
Failed to read input item at offset 86:
invalid item encountered
Not much that I can do with that though. I'll try adding some better error reporting in lib/item/any.c, see where it fails.
Hi,
what about adding a new input format to hidrd-convert so that it can read hex dumps of HID descriptors directly?
gHID (https://code.google.com/p/ghid/) calls this format "dat", it would make sense to import it directly considering that it is used in the hidrd-convert documentation too.
Thanks,
Antonio
Hi, first of all thanks for hidrd-convert.
Would it be possible to add some more options to the code output format, so that it creates descriptors ready to be used in the linux kernel?
Some examples:
enclose the byte array into an actual variable declaration:
static __u8 rdesc[] = {
<TAB>value,
<TAB>value,
...
};
pre-pending one TAB to each line.
Indent the bytes too according to the descriptor structure, i.e. if the comment is indented then the value is indented too (maybe by only one or two spaces, just to give some visual clue about the descriptor structure):
static __u8 rdesc[] = {
<TAB>value, /* usage page */
<TAB> value, /* Collection */
...
};
Show values in both decimal and hex in the comments when this can be useful (for min and max).
Show bitfields more explicitly in the comments:
0x81, 0x03, /* Input 0x3 (Constant:1,Variable:1,Abs:0) */
These are things that other tools (like gHID: https://code.google.com/p/ghid/) do, but the comments produced by hidrd-convert are generally clearer than gHIDs.
Thanks,
Antonio
Would it be possible to cut a new release?
Hi,
I was playing with warning flags and other compilers, and clang -Wall
gives some warnings:
../include/hidrd/item/pfx/size.h:60:35: warning: comparison of constant 4 with expression of type 'hidrd_item_pfx_size' (aka 'enum hidrd_item_pfx_size') is
always false [-Wtautological-constant-out-of-range-compare]
return (bytes <= 2) || (bytes == 4);
In enum hidrd_item_pfx_size you never set a value to 4.
There are other similar warnings.
Can someone include a "how to build" section for NOOBS in the makefile?
I tried:
autoreconf
and it doesn't work. I get errors like:
configure.ac:47: error: required file 'auxdir/ar-lib' not found
Trying to build on Mac (10.14.4) and keep getting short on obstack.h
I've modified the makefile to include one (from another mac ports) - but I'm now failing on this error:
Making all in util
CC obstack.lo
obstack.c:301:5: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
__INT_TO_PTR ((__PTR_TO_INT (new_chunk->contents) + h->alignment_mask)
I can try and disable the warning, but is it safe?
I'm trying to convert a hid-dump with hidrd-convert. but it says invalid item encountered.
this is what I am trying to do:
cat nano_hid_dump | grep -v : | xxd -r -p | hidrd-convert -o spec > nano_spec
Failed to read input item at offset 728:
invalid item encountered
The hid_dump in question I have uploaded here:
https://a.lolisandstuff.moe/pbuwfny
While building a joystick I was having repeated errors even when using a copied report.
The conversion optimizing from A1 00 to A0 breaks microsoft it whines about having collection outside a collection.
It can be useful to indent the descriptor values according to the descriptor structure, i.e. if the comment is indented then the value is indented too in order give a more immediate visual clue about the the descriptor structure.
...
value, /* usage page */
value, /* Collection */
value, /* Report ID */
...
value, /* End Collection */
...
Thanks,
Antonio
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.