Skip to content

Why need sudo for libhidapi-libusb and not for libhidapi-hidraw? #656

Closed

Description

@FauthD

Hi,
on Ubuntu 22.04 I need sudo for a test tool (Python bindings) when libhidapi-libusb is installed.
Enforcing libhidapi-hidraw (by uninstalling libusb backend) allows my tool to run without sudo.
Note: I have access rights to the /dev/hidrawX without sudo.

Thanks!

Activity

  1. Youw commented on Jan 15, 2024

    @Youw
    Member

    From main README:

    Note that you will need to install an udev rule file with your application for unprivileged users to be able to access HID devices with hidapi. Refer to the 69-hid.rules file in the udev directory for an example.

  2. FauthD commented on Jan 15, 2024

    @FauthD
    Author

    That's what I did in first place, did develop USB stuff since 1996 (with Linux since 2004).
    The devices use "root plugdev" (owner group).
    crw-rw---- 1 root plugdev 234, 0 Jan 15 22:13 /dev/hidraw0

    Tools using the HidRaw backend work fine without sudo.
    Only the UsbLib backend needs sudo (unfortunatelly this is prioritized from Python bindings).
    Assumption is some path in /sys/* needs root root. It is that many paths are used in enumeration, probably one of it is the problem.
    Double checked the rights for the .so files, these are the same to each other.

    And some lib (dfUsbLib) I wrote some years ago also works fine without sudo (always worked), but that only used libudev, not libhidraw.

    Next days I will analyze further, just had the hope that someone already knows about this issue.

    Edit: Sure I am a member of group plugdev (since years on that PC).

  3. FauthD commented on Jan 15, 2024

    @FauthD
    Author

    Just got a message this is marked as completed. Not quite right.
    Please repopen.

  4. Youw commented on Jan 15, 2024

    @Youw
    Member

    This is an issue tracker, not a support forum. I'm closing everything that is not related to the implementation of HIDAPI.
    I'll convert it into a discussion - this is the most I can do right now.

  5. locked and limited conversation to collaborators on Jan 15, 2024
  6. converted this issue into a discussion #657 on Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionInformation is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions