Run hidtest for no more than 10 seconds when no hid_read data #440

Merged
Youw merged 1 commit from hidtest into master 2022-08-14 04:33:15 -05:00
Youw commented 2022-08-13 11:30:41 -05:00 (Migrated from github.com)

Avoid infinite reading from the device if the device doesn't send any interrupt reports.
Otherwise hidtest has to be stopped by Ctrl+C interruption, which doesn't give a chance to close the device properly,
as a result this has negative side-effects when using LIBUSB backed.

Avoid infinite reading from the device if the device doesn't send any interrupt reports. Otherwise hidtest has to be stopped by Ctrl+C interruption, which doesn't give a chance to close the device properly, as a result this has negative side-effects when using LIBUSB backed.
Youw commented 2022-08-13 11:32:01 -05:00 (Migrated from github.com)

As a follow-up from the previous conversation, @Julusian may I ask you to try running libusb backand before hidraw and check if kernel driver is reattached properly?
Don't use Ctrl+C, just wait 5 seconds for the hidtest to run.

@mcuee, same request to you.

Thanks.

As a follow-up from the previous conversation, @Julusian may I ask you to try running libusb backand before hidraw and check if kernel driver is reattached properly? Don't use Ctrl+C, just wait 5 seconds for the `hidtest` to run. @mcuee, same request to you. Thanks.
mcuee commented 2022-08-13 22:36:48 -05:00 (Migrated from github.com)

@Youw

The change to hidtest is good to have so that user do not need to hit CTRL-C.

But somehow the kernerl driver does not seem to re-attach.

mcuee@UbuntuSwift3:~/build/hidapi_pr440/build$ ./hidtest/hidtest_libusb 
hidapi test/example tool. Compiled with hidapi version 0.12.0, runtime version 0.12.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 04d8 003f
  path: 3-2.3:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x0 (0x0)

Device Found
  type: 16c0 05dc
  path: 3-1:1.1
  serial_number: 0001
  Manufacturer: www.fischl.de
  Product:      USBasp
  Release:      110
  Interface:    1
  Usage (page): 0x0 (0x0)

Manufacturer String: Microchip Technology Inc.
Product String: Simple HID Device Demo
Serial Number String: (1033) 
Device Found
  type: 04d8 003f
  path: 3-2.3:1.0
  serial_number: (null)
  Manufacturer: Microchip Technology Inc.
  Product:      Simple HID Device Demo
  Release:      2
  Interface:    0
  Usage (page): 0x1 (0xff00)

Indexed String 1: Microchip Technology Inc.
Unable to send a feature report.
Unable to get a feature report: hid_error is not implemented yet
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
waiting...
read() timeout

mcuee@UbuntuSwift3:~/build/hidapi_pr440/build$ ./hidtest/hidtest_hidraw 
hidapi test/example tool. Compiled with hidapi version 0.12.0, runtime version 0.12.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 16c0 05dc
  path: /dev/hidraw1
  serial_number: 0001
  Manufacturer: www.fischl.de
  Product:      USBasp
  Release:      110
  Interface:    1
  Usage (page): 0x1 (0xff00)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x2 (0x1)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x1 (0x1)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x5 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0xe (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x22 (0xd)

Device Found
  type: 06cb cd40
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: 
  Product:      SYNA7DAB:01 06CB:CD40
  Release:      0
  Interface:    -1
  Usage (page): 0x1 (0xff00)

unable to open device

@Youw The change to hidtest is good to have so that user do not need to hit CTRL-C. But somehow the kernerl driver does not seem to re-attach. ``` mcuee@UbuntuSwift3:~/build/hidapi_pr440/build$ ./hidtest/hidtest_libusb hidapi test/example tool. Compiled with hidapi version 0.12.0, runtime version 0.12.0. Compile-time version matches runtime version of hidapi. Device Found type: 04d8 003f path: 3-2.3:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x0 (0x0) Device Found type: 16c0 05dc path: 3-1:1.1 serial_number: 0001 Manufacturer: www.fischl.de Product: USBasp Release: 110 Interface: 1 Usage (page): 0x0 (0x0) Manufacturer String: Microchip Technology Inc. Product String: Simple HID Device Demo Serial Number String: (1033) Device Found type: 04d8 003f path: 3-2.3:1.0 serial_number: (null) Manufacturer: Microchip Technology Inc. Product: Simple HID Device Demo Release: 2 Interface: 0 Usage (page): 0x1 (0xff00) Indexed String 1: Microchip Technology Inc. Unable to send a feature report. Unable to get a feature report: hid_error is not implemented yet waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... waiting... read() timeout mcuee@UbuntuSwift3:~/build/hidapi_pr440/build$ ./hidtest/hidtest_hidraw hidapi test/example tool. Compiled with hidapi version 0.12.0, runtime version 0.12.0. Compile-time version matches runtime version of hidapi. Device Found type: 16c0 05dc path: /dev/hidraw1 serial_number: 0001 Manufacturer: www.fischl.de Product: USBasp Release: 110 Interface: 1 Usage (page): 0x1 (0xff00) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x2 (0x1) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x1 (0x1) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x5 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0xe (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x22 (0xd) Device Found type: 06cb cd40 path: /dev/hidraw0 serial_number: Manufacturer: Product: SYNA7DAB:01 06CB:CD40 Release: 0 Interface: -1 Usage (page): 0x1 (0xff00) unable to open device ```
mcuee (Migrated from github.com) reviewed 2022-08-13 22:55:22 -05:00
mcuee (Migrated from github.com) left a comment

The change is good to have.

The change is good to have.
mcuee (Migrated from github.com) approved these changes 2022-08-13 22:56:58 -05:00
mcuee (Migrated from github.com) left a comment

Even though it does not sort out the kernel driver re-attach issue (probably another issue to sort out), this chage itself is good to have.

Even though it does not sort out the kernel driver re-attach issue (probably another issue to sort out), this chage itself is good to have.
Youw commented 2022-08-14 04:33:01 -05:00 (Migrated from github.com)

thanks

thanks
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi!440
No description provided.