Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 948216 - sys-apps/usbutils missing usbreset util
Summary: sys-apps/usbutils missing usbreset util
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2025-01-17 08:18 UTC by Daniel Hiepler
Modified: 2025-01-31 10:17 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Hiepler 2025-01-17 08:18:56 UTC
017 included the usbreset utility which is gone after upgrading to 018.

Upstream changelog [1] doesn't mention removal, only "Add a manpage for usbreset"


[1] https://lwn.net/Articles/995109/

Reproducible: Always
Comment 1 Zhixu Liu 2025-01-17 08:49:14 UTC
see following copied from meson.build:

> # By default, usbreset does not get installed as it could cause problems, it's
> # in the repo for those that wish to try it out.
> executable('usbreset', usbreset_sources, install: false)

so it seems upstream consider it's still unstable.

for test, one can:
# ebuild sys-apps/usbutils/usbutils-018.ebuild clean install

executable is here:

/var/tmp/portage/sys-apps/usbutils-018/work/usbutils-018-build/usbreset
Comment 2 Zhixu Liu 2025-01-17 09:21:05 UTC
maybe wen can decide whether to install or not by a user controlled USE flag (disabled by default)?
Comment 3 Daniel Hiepler 2025-01-17 09:28:38 UTC
As far as I understand, it was stable before and will become stable again eventually?

Besides, a USE flag would be awesome of course and certainly wouldn't hurt.
Comment 4 Zhixu Liu 2025-01-17 10:16:32 UTC
> As far as I understand, it was stable before and will become stable again
> eventually?

it's handled in src_install:

    dobin usbreset # noinst_PROGRAMS, but installed by other distros

since 018, build system switch to meson, so this is missed?

I'll submit a PR to include it back
Comment 5 Daniel Hiepler 2025-01-17 10:20:00 UTC
awesome, thank you!
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-17 11:43:34 UTC
FWIW:
```
commit 0af5b4968d579ce53f5e1e2f8274c90291493f2b
Author: Sam James <sam@gentoo.org>
Date:   Thu Nov 14 04:32:17 2024 +0000

    sys-apps/usbutils: add 018

    * Switch to Meson

    * Drop usbreset

      I've not kept usbreset as in meson.build, it's marked as:
      """
      By default, usbreset does not get installed as it could cause problems, it's
      in the repo for those that wish to try it out.
      """

      If someone wants it, please file a bug to let us know.

    * Fix LICENSE to be GPL-2+

    Signed-off-by: Sam James <sam@gentoo.org>

```
Comment 7 Zhixu Liu 2025-01-17 12:46:45 UTC
>       If someone wants it, please file a bug to let us know.

ah, i missed this.

I also recall I've a use case which need 'usbreset' to work. It's a usb wireless NIC, after first insert, it'll show as a USB storage (which has driver for windows system), only after reset, it'll show up as NIC.

So let's included it back, :)
Comment 8 Daniel Hiepler 2025-01-17 12:57:48 UTC
For me it's the prime solution for buggy/crashing firmware. Regular health checks + usbreset makes those bad dongles & devices usable.

I wouldn't mind setting a USE flag that is off by default.
Comment 9 Zhixu Liu 2025-01-20 07:19:18 UTC
> I also recall I've a use case which need 'usbreset' to work. It's a usb
> wireless NIC, after first insert, it'll show as a USB storage (which has
> driver for windows system), only after reset, it'll show up as NIC.

I remembered it wrongly, the command I used is usb_modeswitch, so I don't know is it safe to include usbreset back w/o controlled by USE? If a USE is required, please suggest one?
Comment 10 Daniel Hiepler 2025-01-20 09:01:50 UTC
I just asked upstream [1] and it seems it could potentially damage hardware.
(I can't see that, since usbreset is basically just a helping wrapper around USBDEVFS_RESET ioctl, but what do I know.)

Personally, I'm using it for years (since the advent of cheap USB SDRs which can be used 24/7 by resetting them reqularly) without any problems [2]. But I could use my own ebuild, since there are multiple versions of usbreset.c floating around.

To avoid potential bugreports about burning hardware, it might be favorable to not include it and have users manually compile it.

Otherwise i'd suggest "usbreset - additionally compile the potentially problematic usbreset util" as USE flag, since it's self explaining without description and shouldn't collide with other USE flags.

[1] https://github.com/gregkh/usbutils/issues/214
[2] https://www.rtl-sdr.com/fixing-usb-reset-problems-for-247-rtl_433-monitoring/
Comment 11 Zhixu Liu 2025-01-20 10:21:05 UTC
PR updated, 'usbreset' will be built only with both USE="usbreset" and environment variable "I_ALLOW_TO_BREAK_MY_HARDWARE=yes".