Giter Club home page Giter Club logo

hidpp's People

Contributors

cvuchener avatar flherne avatar hadess avatar kokx avatar pedrovanzella avatar pnrao avatar severnt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hidpp's Issues

Can't get it to build

I'm trying to build, but it's giving me a bunch of errors... perhaps cmake isn't adding an important flag to the makefile somewhere?

[ 93%] Built target hidpp-check-device
[ 94%] Building CXX object src/tools/CMakeFiles/hidpp20-raw-touchpad-driver.dir/hidpp20-raw-touchpad-driver.cpp.o
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/5/vector:60,
                 from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:20:
/usr/include/c++/5/bits/stl_pair.h: In instantiation of ‘constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = const char*&; <template-parameter-2-2> = void; _T1 = const std::__cxx11::basic_string<char>; _T2 = MyMonitor::node]’:
/usr/include/c++/5/ext/new_allocator.h:120:4:   required from ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node>; _Args = {const char*&, const char*&}; _Tp = std::_Rb_tree_node<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >]’
/usr/include/c++/5/bits/alloc_traits.h:530:4:   required from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node>; _Args = {const char*&, const char*&}; _Tp = std::_Rb_tree_node<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::_Rb_tree_node<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> > >]’
/usr/include/c++/5/bits/stl_tree.h:529:32:   required from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_construct_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type, _Args&& ...) [with _Args = {const char*&, const char*&}; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >*]’
/usr/include/c++/5/bits/stl_tree.h:546:21:   required from ‘std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const char*&, const char*&}; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >*]’
/usr/include/c++/5/bits/stl_tree.h:2123:33:   required from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_unique(_Args&& ...) [with _Args = {const char*&, const char*&}; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >]’
/usr/include/c++/5/bits/stl_map.h:559:64:   required from ‘std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::emplace(_Args&& ...) [with _Args = {const char*&, const char*&}; _Key = std::__cxx11::basic_string<char>; _Tp = MyMonitor::node; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, MyMonitor::node> >]’
/home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:346:35:   required from here
/usr/include/c++/5/bits/stl_pair.h:134:45: error: use of deleted function ‘MyMonitor::node::node(const MyMonitor::node&)’
  : first(std::forward<_U1>(__x)), second(__y) { }
                                             ^
/home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:321:9: note: ‘MyMonitor::node::node(const MyMonitor::node&)’ is implicitly deleted because the default definition would be ill-formed:
  struct node
         ^
/home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:321:9: error: use of deleted function ‘HIDPP::DispatcherThread::DispatcherThread(const HIDPP::DispatcherThread&)’
In file included from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:38:0:
/home/robomancer/code/hidpp/src/tools/../libhidpp/hidpp/DispatcherThread.h:32:7: note: ‘HIDPP::DispatcherThread::DispatcherThread(const HIDPP::DispatcherThread&)’ is implicitly deleted because the default definition would be ill-formed:
 class DispatcherThread: public Dispatcher
       ^
/home/robomancer/code/hidpp/src/tools/../libhidpp/hidpp/DispatcherThread.h:32:7: error: use of deleted function ‘std::mutex::mutex(const std::mutex&)’
In file included from /home/robomancer/code/hidpp/src/tools/common/EventQueue.h:23:0,
                 from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:26:
/usr/include/c++/5/mutex:129:5: note: declared here
     mutex(const mutex&) = delete;
     ^
In file included from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:38:0:
/home/robomancer/code/hidpp/src/tools/../libhidpp/hidpp/DispatcherThread.h:32:7: error: use of deleted function ‘std::mutex::mutex(const std::mutex&)’
 class DispatcherThread: public Dispatcher
       ^
In file included from /home/robomancer/code/hidpp/src/tools/common/EventQueue.h:23:0,
                 from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:26:
/usr/include/c++/5/mutex:129:5: note: declared here
     mutex(const mutex&) = delete;
     ^
/home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:321:9: error: use of deleted function ‘std::thread::thread(const std::thread&)’
  struct node
         ^
In file included from /usr/include/c++/5/future:40:0,
                 from /home/robomancer/code/hidpp/src/tools/../libhidpp/hidpp/DispatcherThread.h:24,
                 from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:38:
/usr/include/c++/5/thread:126:5: note: declared here
     thread(const thread&) = delete;
     ^
/home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:321:9: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = Driver; _Dp = std::default_delete<Driver>]’
  struct node
         ^
In file included from /usr/include/c++/5/condition_variable:43:0,
                 from /home/robomancer/code/hidpp/src/tools/common/EventQueue.h:24,
                 from /home/robomancer/code/hidpp/src/tools/hidpp20-raw-touchpad-driver.cpp:26:
/usr/include/c++/5/bits/unique_ptr.h:356:7: note: declared here
       unique_ptr(const unique_ptr&) = delete;
       ^
make[2]: *** [src/tools/CMakeFiles/hidpp20-raw-touchpad-driver.dir/hidpp20-raw-touchpad-driver.cpp.o] Error 1

Unifying receiver stops working after a short while with Thunderbolt dock

The system is a Dell Precision 7730 running Ubuntu 18.04.1 with Dell TB18 Thunderbolt dock. When I plug the unifying receiver to the laptop directly, it works just fine. When plugged to a USB port on the TB18 dock, it works for about a minute and then stops working. Plug out / plug in yields the same result. Running usbhid-dump resurrects it briefly, it then stops working again. Nothing on dmesg.

Same behavior on three identical setups.

How can I chase this issue further?

Error while asking receiver for infos: Unknown device

Just wondering if the following can be fixed.

./hidpp-list-devices.exe
USB\VID_046D&PID_C534&MI_01\6&1CFA36F4&0&0001: Logitech USB Receiver (046d:c534) HID++ 1.0
[error] Error while asking receiver for infos: Unknown device
USB\VID_046D&PID_C534&MI_01\6&1CFA36F4&0&0001 (device 2): Wireless Mouse (046d:4054) HID++ 4.5

Device fails when writing a profile with <=2 dpi modes and DPI index <=2

Hi, I encountered this strange problem when using the library, I replicated it using hidpp-persistent-profiles on a g402:
make sure to have at least 3 or more dpi modes in your profile (and make a backup of the page, I managed to recover the mouse only this way)
select the first (or second) dpi mode
rewrite the profile and leave only the first two dpi modes (I used ./hidpp-persistent-profiles /dev/hidraw3 read > profile.xml, removed those modes, saved and then ./hidpp-persistent-profiles /dev/hidraw3 write profile.xml)
Now the mouse behaves strangely, dpi index cannot be changed anymore (neither with IOnboardProfiles::setCurrentDPIIndex nor using the mouse buttons). If I try to write the previous xml profile and then read the profile again, this error appears:

terminate called after throwing an instance of 'std::range_error'
what(): wstring_convert::to_bytes

The only way I found to restore the original behaviour is to write the page from a previous dump.

Does this also happen to you?

macOS support

It would be nice to have macOS support. macOS has native HID API which should do the work.

How to specify the hid device index?

Sorry but this does not seem to be documented.

$ ./hidpp-list-devices.exe
USB\VID_046D&PID_C534&MI_01\6&1CFA36F4&0&0001: Logitech USB Receiver (046d:c534) HID++ 1.0
[error] Error while asking receiver for infos: Unknown device
USB\VID_046D&PID_C534&MI_01\6&1CFA36F4&0&0001 (device 2): Wireless Mouse (046d:4054) HID++ 4.5
USB\VID_046D&PID_C534&MI_01\6&2FB3E799&0&0001: Logitech USB Receiver (046d:c534) HID++ 1.0
[error] Error while asking receiver for infos: Unknown device
USB\VID_046D&PID_C534&MI_01\6&2FB3E799&0&0001 (device 2): Wireless Mouse (046d:4054) HID++ 4.5

Device path is okay.

./hidpp-list-features.exe "USB\VID_046D&PID_C534&MI_01\6&1CFA36F4&0&0001"
Logitech USB Receiver (046d:c534) is a HID++ 1.0 device
Register 0x00 read   3: 00 00 00
Register 0x02 read   3: 00 01 18
Register 0xb5 read  16: Invalid value (0x03)
Register 0xd0 read   3: 00 00 00
Register 0xd2 read   3: Invalid value (0x03)
Register 0xd4 read   3: Invalid value (0x03)
Register 0xd5 read  16: 00 d1 91 1d 07 20 17 09 09 00 00 00 00 00 00 00
Register 0xd6 read   3: 09 00 00
Register 0xe6 read   3: 00 00 00
Register 0xf1 read   3: Invalid value (0x03)

What about wireless device index? What does the index mean?

$ ./hidpp-list-features.exe -h
Usage: C:\work\hid\hidpp_test\build\src\tools\hidpp-list-features.exe [options] device_path
Options are:
        -d,--device index       Use wireless device index.
        -v,--verbose [list]     Enable verbose mode or change verbosity settings from a comma-separated list of category setting: [-]category[:subcategory].
        -w,--write      Also do write tests with HID++ 1.0 devices.
        -h,--help       Print this message.

$ ./hidpp-list-features.exe -d 2  "USB\VID_046D&PID_C534&MI_01\6&1CFA36F4&0&0001"
Wireless Mouse (046d:4054) is a HID++ 4.5 device
Feature 0x01: [0x0001] Feature set
Feature 0x02: [0x0003] Device FW version
Feature 0x03: [0x0005] Device name
Feature 0x04: [0x0020] Reset
Feature 0x05: [0x1b04] Reprog controls v4
Feature 0x06: [0x1d4b] Wireless device status
Feature 0x07: [0x2130] Low-res wheel
Feature 0x08: [0x2205] Pointer speed
Feature 0x09: [0x1802] Device reset (hidden, internal)
Feature 0x0a: [0x1810] ? (hidden, internal)
Feature 0x0b: [0x1830] ? (hidden, internal)
Feature 0x0c: [0x1850] ? (hidden, internal)
Feature 0x0d: [0x1869] ? (hidden, internal)
Feature 0x0e: [0x1890] ? (hidden, internal)
Feature 0x0f: [0x18b1] ? (hidden, internal)
Feature 0x10: [0x1df3] ? (hidden, internal)
Feature 0x11: [0x1e00] Enable hidden features (hidden)
Feature 0x12: [0x1f03] ? (hidden, internal)
Feature 0x13: [0x1e80] ? (hidden, internal)

non-connected devices give error

I just go the following output from a Logitech Unifying Receiver paired with a Craft Keyboard and an MX Master 3. The Craft Keyboard was not connected at the time.

idefix build> ./src/tools/hidpp-list-devices
/dev/hidraw14: Logitech USB Receiver (046d:c52b) HID++ 1.0
[error] Error while querying /dev/hidraw14 wireless device 1: Resource error
/dev/hidraw14 (device 2): MX Master 3 (046d:4082) HID++ 4.5

It looks as if non-connected devices give this resource error. Wouldn't it be better to provide a better response?

Request for help implementing HID protocol in BrailleTouch project

Hello,

I hope this message finds you well. I am reaching out to you because I am working on an open-source project called BrailleTouch. Our goal is to create affordable Braille displays for blind and deaf-blind individuals.

We are currently stuck and unable to get the HID Braille to receive information from the screen reader and continue programming. As someone with experience in this area, your expertise could be of great help to our project.

I believe that an open-source Braille display could be incredibly useful and have many benefits for those who are blind and deaf-blind. Your knowledge of the HID protocol could be particularly helpful in implementing the protocol in our Braille display.

Please take a moment to review our project on GitHub at https://github.com/brailletouch. If you're interested in helping, please let me know.

Thank you for your time and consideration. I look forward to hearing back from you.

Best regards,

Cergio Monasterio

Minor compiler warnings under Linux

Here are some warnings under Linux (gcc 10.3, ARM64).

[ 74%] Building CXX object src/tools/CMakeFiles/hidpp10-load-temp-profile.dir/hidpp10-load-temp-profile.cpp.o
/home/mcuee/build/libusb/hidpp/src/tools/hidpp10-load-temp-profile.cpp: In function ‘int main(int, char**)’:
/home/mcuee/build/libusb/hidpp/src/tools/hidpp10-load-temp-profile.cpp:119:67: warning: narrowing conversion of ‘((profile_format.std::unique_ptr<HIDPP::AbstractProfileFormat>::operator->()->HIDPP::AbstractProfileFormat::size() + 1) / 2)’ from ‘size_t’ {aka ‘long unsigned int’} to ‘unsigned int’ [-Wnarrowing]
  119 |   HIDPP::Address macro_address { 0, 0, (profile_format->size ()+1)/2 };
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
...

[ 98%] Building CXX object src/tools/CMakeFiles/hidpp20-led-control.dir/hidpp20-led-control.cpp.o
/home/mcuee/build/libusb/hidpp/src/tools/hidpp20-led-control.cpp: In function ‘int main(int, char**)’:
/home/mcuee/build/libusb/hidpp/src/tools/hidpp20-led-control.cpp:244:11: warning: unused variable ‘mode’ [-Wunused-variable]
  244 |      auto mode = Modes.value(argv[first_arg+1]);
      |           ^~~~


compile errors with gcc 11.2.1

I'm trying to build hidpp on Fedora with gcc 11.2.1 and I'm getting compiler errors.

The first few are:

In file included from /home/local/SoftwareDownloads/hidpp/src/libhidpp/hidpp/Device.cpp:19:
/home/local/SoftwareDownloads/hidpp/src/libhidpp/hidpp/Device.h:46:22: error: ‘string’ in namespace ‘std’ does not name a type
   46 |                 std::string _msg;
      |                      ^~~~~~
/home/local/SoftwareDownloads/hidpp/src/libhidpp/hidpp/Device.h:25:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
   24 | #include <tuple>
  +++ |+#include <string>
   25 | 
/home/local/SoftwareDownloads/hidpp/src/libhidpp/hidpp/Device.h:83:14: error: ‘string’ in namespace ‘std’ does not name a type
   83 |         std::string name () const;
      |              ^~~~~~

I was able to fix these (and more) by adding `#include ' to Device.h

But now I am getting error: ‘runtime_error’ is not a member of ‘std’. How do I fix this?

How can I get the device_path on Windows

Hi,
Thank you for build this useful tools which make my logi MX master 3 work well with my ubuntu.

But not I want to use the tools in my windows 10 laptop.

I don't know how can i get the device_path in windows.
I have try to use the .\hidpp-list-devices.exe
image
And I get some thing like in the fig.

Any ideas?

Thank you again.

Compiling on Windows

I am trying to compile this on windows.
Got all the tools setup like cmake and make but having some rudimentary compile issues.

  • How/Where do I add TinyXML2 to the build folder ?, does it need the sources or the compiled lib.
  • Once I run cmake it sets up everything in build folder apart from a MakeFile, i.e. make doesn't have anything to run against.

Sorry for these pretty simple build issues, I promise to try and contribute anything I learn about the windows build.

Issue compiling on gentoo

-- The C compiler identification is GNU 7.1.0
-- The CXX compiler identification is GNU 7.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.3.7") 
-- Checking for module 'tinyxml2'
--   Found tinyxml2, version 5.0.1
-- Checking for module 'libudev'
--   Found libudev, version 220
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hanetzer/Projects/hidpp/build
hanetzer@proprietary-killer ~/Projects/hidpp/build $ make 
Scanning dependencies of target hidpp
[  1%] Building CXX object src/libhidpp/CMakeFiles/hidpp.dir/misc/HIDRaw.cpp.o
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp: In member function ‘int HIDRaw::readReport(std::vector<unsigned char>&, int)’:
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:145:2: error: ‘timeval’ was not declared in this scope
  timeval to = { timeout/1000, (timeout%1000) * 1000 };
  ^~~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:145:2: note: suggested alternative: ‘timegm’
  timeval to = { timeout/1000, (timeout%1000) * 1000 };
  ^~~~~~~
  timegm
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:146:2: error: ‘fd_set’ was not declared in this scope
  fd_set fds;
  ^~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:146:2: note: suggested alternative: ‘fdopen’
  fd_set fds;
  ^~~~~~
  fdopen
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:148:13: error: ‘fds’ was not declared in this scope
   FD_ZERO (&fds);
             ^~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:148:3: error: ‘FD_ZERO’ was not declared in this scope
   FD_ZERO (&fds);
   ^~~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:148:3: note: suggested alternative: ‘CPU_ZERO’
   FD_ZERO (&fds);
   ^~~~~~~
   CPU_ZERO
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:149:3: error: ‘FD_SET’ was not declared in this scope
   FD_SET (_fd, &fds);
   ^~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:149:3: note: suggested alternative: ‘L_SET’
   FD_SET (_fd, &fds);
   ^~~~~~
   L_SET
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:153:31: error: ‘to’ was not declared in this scope
     (timeout < 0 ? nullptr : &to));
                               ^~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:153:31: note: suggested alternative: ‘tm’
     (timeout < 0 ? nullptr : &to));
                               ^~
                               tm
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:151:9: error: ‘select’ was not declared in this scope
   ret = select (std::max (_fd, _pipe[0])+1,
         ^~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:151:9: note: suggested alternative: ‘splice’
   ret = select (std::max (_fd, _pipe[0])+1,
         ^~~~~~
         splice
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:157:22: error: ‘fds’ was not declared in this scope
  if (FD_ISSET (_fd, &fds)) {
                      ^~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:157:6: error: ‘FD_ISSET’ was not declared in this scope
  if (FD_ISSET (_fd, &fds)) {
      ^~~~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:157:6: note: suggested alternative: ‘CPU_ISSET’
  if (FD_ISSET (_fd, &fds)) {
      ^~~~~~~~
      CPU_ISSET
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:165:27: error: ‘fds’ was not declared in this scope
  if (FD_ISSET (_pipe[0], &fds)) {
                           ^~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:165:6: error: ‘FD_ISSET’ was not declared in this scope
  if (FD_ISSET (_pipe[0], &fds)) {
      ^~~~~~~~
/home/hanetzer/Projects/hidpp/src/libhidpp/misc/HIDRaw.cpp:165:6: note: suggested alternative: ‘CPU_ISSET’
  if (FD_ISSET (_pipe[0], &fds)) {
      ^~~~~~~~
      CPU_ISSET
make[2]: *** [src/libhidpp/CMakeFiles/hidpp.dir/build.make:63: src/libhidpp/CMakeFiles/hidpp.dir/misc/HIDRaw.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: src/libhidpp/CMakeFiles/hidpp.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Unsure how to proceed. Fresh clone today.

turning on debug logging

I'm the maintainer of Solaar, a mostly GUI-based tool to control HID++ devices. I'm trying to find out why Solaar is not working with a particular device that works fine in hidpp. I would like to take a look at what hidpp is sending to the device and it appears that there is debugging code in hidpp.

However, I can't see how to turn it on. Please let me know how to turn debugging logging on. Thanks.

Hidpp list features explanation

Hi, I was writing a program for configuring my mouse (g402) under linux, then I found your library and I switched to using it. It works really well, good job!
I am trying to understand better the inner workings of the protocol used, however I don't understand what these mean (tools/hidpp-list-features):

Logitech Gaming Mouse G402 (046d:c07e) is a HID++ 4.2 device
Feature 0x01: [0x0001]
Feature 0x02: [0x0003]
Feature 0x03: [0x0005]
Feature 0x04: [0x00c1]
Feature 0x05: [0x1300]
Feature 0x06: [0x1801] hidden
Feature 0x07: [0x1802] hidden
Feature 0x08: [0x1850] hidden
Feature 0x09: [0x18a1] hidden
Feature 0x0a: [0x1e00] hidden
Feature 0x0b: [0x1eb0] hidden
Feature 0x0c: [0x2201]
Feature 0x0d: [0x2400]
Feature 0x0e: [0x8060]
Feature 0x0f: [0x8100]
Feature 0x10: [0x8110]

Are these "features" all the same for hid++ devices (or instance, I found out that all led configurations are done using a feature id of 0x05)?

Also this:

Memory model: 1
Profile format: 1
Macro format: 1
Profile count: 1
Profile count OOB: 1
Button count: 8
Sector count: 3
Sector size: 1024
Mechanical layout: 0xa (G-shift, DPI shift)
Various info: 0x1 (Corded)

What do memory model, profile, macro, count etc stand for?

Thank you

Some HID++ devices not recognized

Currently parts of the HID report descriptor are hardcoded with, for example, the two recognized variants of the long report being:

0x06, 0x00, 0xFF,  // Usage Page (Vendor Defined 0xFF00)
0x09, 0x02,        // Usage (0x02)
0xA1, 0x01,        // Collection (Application)
0x85, 0x11,        //   Report ID (17)
0x75, 0x08,        //   Report Size (8)     ←
0x95, 0x13,        //   Report Count (19)   ←
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x09, 0x02,        //   Usage (0x02)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x02,        //   Usage (0x02)
0x91, 0x00,        //   Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection
0x06, 0x00, 0xFF,  // Usage Page (Vendor Defined 0xFF00)
0x09, 0x02,        // Usage (0x02)
0xA1, 0x01,        // Collection (Application)
0x85, 0x11,        //   Report ID (17)
0x95, 0x13,        //   Report Count (19)   ←
0x75, 0x08,        //   Report Size (8)     ←
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x09, 0x02,        //   Usage (0x02)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x02,        //   Usage (0x02)
0x91, 0x00,        //   Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

Many (newer) devices, e.g. the Yeti X WoW Edition G213 support HID++ 2.0 through different reports like this one (full report descriptor here):

0x06, 0x43, 0xFF,  // Usage Page (Vendor Defined 0xFF43)   ←
0x0A, 0x02, 0x06,  // Usage (0x0602)                       ←
0xA1, 0x01,        // Collection (Application)
0x85, 0x11,        //   Report ID (17)
0x75, 0x08,        //   Report Size (8)
0x95, 0x13,        //   Report Count (19)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x09, 0x02,        //   Usage (0x02)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x02,        //   Usage (0x02)
0x91, 0x00,        //   Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

Note the different usage page and usage values. Also, this particular device does not have the short report at all, only the long and very long one.

Anyway, hardcoding chunks of the report descriptors doesn't scale well because there's an infinite number of ways to describe the same reports and the HID++ 2.0 specification does not call for a particular sequence of items. A better way of doing things would be to parse the HID report descriptor and simply look for the reports with the right usage page, usage, report ID, and size.

If there is interest I would like to contribute such a parser and hook it up, so that we could replace the hardcoded chunks in question, thereby allowing libhidpp to work with a lot more HID++ devices.

Duplicated buttons info with hidpp-persistent-profiles

Hi, I noticed that the library prints out the button mappings twice (g402). Here is the output:

./hidpp-persistent-profiles /dev/hidraw3 read

<profiles>
    <profile>
        <dir_unknown>0</dir_unknown>
        <enabled>true</enabled>
        <modes>
            <mode>
                <dpi>400</dpi>
            </mode>
            <mode>
                <dpi>800</dpi>
            </mode>
            <mode>
                <dpi>1600</dpi>
            </mode>
            <mode>
                <dpi>350</dpi>
            </mode>
        </modes>
        <angle_snapping>false</angle_snapping>
        <color>ffffff</color>
        <default_dpi>0</default_dpi>
        <name></name>
        <report_rate>3</report_rate>
        <revision>33</revision>
        <switched_dpi>0</switched_dpi>
        <buttons>
            <mouse-button>0</mouse-button>
            <mouse-button>1</mouse-button>
            <mouse-button>2</mouse-button>
            <mouse-button>3</mouse-button>
            <mouse-button>4</mouse-button>
            <special>ResolutionSwitch</special>
            <special>ResolutionPrev</special>
            <special>ResolutionNext</special>
            <mouse-button>0</mouse-button>
            <mouse-button>1</mouse-button>
            <mouse-button>2</mouse-button>
            <mouse-button>3</mouse-button>
            <mouse-button>4</mouse-button>
            <special>ResolutionSwitch</special>
            <special>ResolutionPrev</special>
            <special>ResolutionNext</special>
        </buttons>
    </profile>
</profiles>

I don't know if this issue is related to the profile, since there seems to be duplicate information also there:

00000000: 0300 0090 0120 0340 065e 0100 00ff ffff  ..... .@.^......
00000010: ff00 2100 ffff ffff ffff ffff ffff ffff  ..!.............
00000020: 8001 0001 8001 0002 8001 0004 8001 0008  ................
00000030: 8001 0010 9007 ffff 9004 ffff 9003 ffff  ................
00000040: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000050: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000060: 8001 0001 8001 0002 8001 0004 8001 0008  ................
00000070: 8001 0010 9007 ffff 9004 ffff 9003 ffff  ................
00000080: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000090: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000d0: 0002 0000 0000 28df 0008 51d3 0008 59d3  ......(...Q...Y.
000000e0: 0008 0500 0003 0000 0000 3cdf 0008 67d3  ..........<...g.
000000f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000100: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000110: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000120: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000130: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000140: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000150: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000160: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000170: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000180: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000190: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000001f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000200: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000210: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000220: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000230: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000240: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000250: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000260: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000270: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000280: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000290: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000002f0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000300: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000310: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000320: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000330: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000340: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000350: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000360: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000370: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000380: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000390: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003a0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003b0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003c0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003d0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003e0: ffff ffff ffff ffff ffff ffff ffff ffff  ................
000003f0: ffff ffff ffff ffff ffff ffff ffff e94e  ...............N

Report's answer comes as INTERRUPT, not as SET_REPORT response

I couldn't get the idea of it. I intercept the Wireshark packets of hidpp20-call-function, while the binary returns back the correct data, Wireshark returns an empty SET_REPORT response and an INTERRUPT IN packet that contains the actual expected values.

How does hidpp20-call-function handles this behaviour?

Thanks!

hidpp-list-features crashes with g700s

hidpp-list-features crashes in line 120 dev.getProtocolVersion (major, minor);
with message

terminate called after throwing an instance of 'HIDRaw::TimeoutError'
  what():  std::exception

Breakpoint 2, __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

(two bottom lines are from gdb)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.