#1105785 evtest: Sort the list of event sources numerically, not lexicographically

Package:
evtest
Source:
evtest
Description:
utility to monitor Linux input device events
Submitter:
Gunnar Wolf
Date:
2025-05-14 18:30:02 UTC
Severity:
normal
Tags:
#1105785#5
Date:
2025-05-14 18:19:22 UTC
From:
To:
When running evtest, a list of devices providing information
via/dev/input/event* is generated. However, its ordering is not clear to
the user:

    # evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:	Power Button
    /dev/input/event1:	Power Button
    /dev/input/event10:	HDA Intel HDMI HDMI/DP,pcm=7
    /dev/input/event11:	HDA Intel HDMI HDMI/DP,pcm=8
    /dev/input/event12:	HDA Digital PCBeep
    /dev/input/event13:	HDA Intel PCH Front Mic
    /dev/input/event14:	HDA Intel PCH Rear Mic
    /dev/input/event15:	HDA Intel PCH Line
    /dev/input/event16:	HDA Intel PCH Line Out
    /dev/input/event17:	HDA Intel PCH Front Headphone
    /dev/input/event2:	Video Bus
    /dev/input/event3:	Lite-On Tech IBM USB Travel Keyboard with UltraNav
    /dev/input/event4:	Lite-On Tech IBM USB Travel Keyboard with UltraNav System Control
    /dev/input/event5:	Lite-On Tech IBM USB Travel Keyboard with UltraNav Consumer Control
    /dev/input/event6:	Synaptics Inc. Composite TouchPad / TrackPoint
    /dev/input/event7:	Synaptics Inc. Composite TouchPad / TrackPoint (Stick)
    /dev/input/event8:	PC Speaker
    /dev/input/event9:	HDA Intel HDMI HDMI/DP,pcm=3
    Select the device event number [0-17]:

I do not believe my system to be too atypical; having more than 9 event
sources is common. It was confusing for me to be asked for a numbered line,
and have a list in the wrong order. I think it should be presented as:

    # evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:	Power Button
    /dev/input/event1:	Power Button
    /dev/input/event2:	Video Bus
    /dev/input/event3:	Lite-On Tech IBM USB Travel Keyboard with UltraNav
    /dev/input/event4:	Lite-On Tech IBM USB Travel Keyboard with UltraNav System Control
    /dev/input/event5:	Lite-On Tech IBM USB Travel Keyboard with UltraNav Consumer Control
    /dev/input/event6:	Synaptics Inc. Composite TouchPad / TrackPoint
    /dev/input/event7:	Synaptics Inc. Composite TouchPad / TrackPoint (Stick)
    /dev/input/event8:	PC Speaker
    /dev/input/event9:	HDA Intel HDMI HDMI/DP,pcm=3
    /dev/input/event10:	HDA Intel HDMI HDMI/DP,pcm=7
    /dev/input/event11:	HDA Intel HDMI HDMI/DP,pcm=8
    /dev/input/event12:	HDA Digital PCBeep
    /dev/input/event13:	HDA Intel PCH Front Mic
    /dev/input/event14:	HDA Intel PCH Rear Mic
    /dev/input/event15:	HDA Intel PCH Line
    /dev/input/event16:	HDA Intel PCH Line Out
    /dev/input/event17:	HDA Intel PCH Front Headphone
    Select the device event number [0-17]:

Thank you very much!