cr8t / udev

Pure Rust interface to the userspace devfs (udev) subsystem on Linux
GNU General Public License v2.0
4 stars 1 forks source link

HWDB: Trie search not working correctly #25

Open tuna-f1sh opened 1 week ago

tuna-f1sh commented 1 week ago

Seems like I didn't test fully #23 as it still doesn't seem to work properly. It often incorrectly returns:

Too many keys

❯ cargo run --example systemd-hwdb "usb:v1D6Bp0001"
ID_USB_CLASS_FROM_DATABASE: Audio
ID_USB_SUBCLASS_FROM_DATABASE: Boot Interface Subclass
ID_USB_SUBCLASS_FROM_DATABASE: MCTCP Host
# ^ above are not valid returns
ID_VENDOR_FROM_DATABASE: Linux Foundation
ID_AUTOSUSPEND: 1
ID_MODEL_FROM_DATABASE: 1.1 root hub
❯ systemd-hwdb query usb:v1D6Bp0001                                                                                                                                                          
ID_VENDOR_FROM_DATABASE=Linux Foundation                                                                                                                                                     
ID_AUTOSUSPEND=1                                                                                                                                                                             
ID_MODEL_FROM_DATABASE=1.1 root hub 

No results

❯ cargo run --example systemd-hwdb "usb:v*p*d*dc03*"
❯ systemd-hwdb query "usb:v*p*d*dc03*"
ID_USB_CLASS_FROM_DATABASE=Human Interface Device

This isn't critical for me but wanted to capture the issue. I know hwdb isn't well documented so it's hard to dig into this bug. Since it almost there though wondered if you have any ideas. I have updated the test and the example above is in my fork: https://github.com/cr8t/udev/compare/main...tuna-f1sh:udev:main