1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-08-29 01:50:15 +03:00

Merge pull request #21977 from systemd/wip/hadess/minipro-uaccess

hwdb: Allow end-users root-less access to TL866 EPROM readers
This commit is contained in:
Luca Boccassi
2022-01-04 15:51:28 +00:00
committed by GitHub
3 changed files with 19 additions and 7 deletions

View File

@ -12,7 +12,7 @@
# Total Phase
###########################################################
# Aarvark I2C/SPI Host Adapter
usb:v0403pe0d0*
usb:v0403pE0D0*
ID_SIGNAL_ANALYZER=1
# Beagle Protocol Analyzers
@ -29,5 +29,16 @@ usb:v1679p3001*
# Power Delivery Analyzers
usb:v1679p6003*
usb:v0483pdf11*
usb:v0483pDF11*
ID_SIGNAL_ANALYZER=1
###########################################################
# XGecu
###########################################################
# TL866A/CS
usb:v04D8pE11C*
ID_SIGNAL_ANALYZER=1
# TL866II+
usb:vA466p0A53*
ID_SIGNAL_ANALYZER=1

View File

@ -212,21 +212,23 @@ def check_matches(groups):
# This is a partial check. The other cases could be also done, but those
# two are most commonly wrong.
grammars = { 'usb' : 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4)),
'pci' : 'v' + upperhex_word(8) + Optional('d' + upperhex_word(8)),
grammars = { 'usb' : 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4) + Optional(':')) + '*',
'pci' : 'v' + upperhex_word(8) + Optional('d' + upperhex_word(8) + Optional(':')) + '*',
}
for match in matches:
prefix, rest = match.split(':', maxsplit=1)
gr = grammars.get(prefix)
if gr:
# we check this first to provide an easy error message
if rest[-1] not in '*:':
error('pattern {} does not end with "*" or ":"', match)
try:
gr.parseString(rest)
except ParseBaseException as e:
error('Pattern {!r} is invalid: {}', rest, e)
continue
if rest[-1] not in '*:':
error('pattern {} does not end with "*" or ":"', match)
matches.sort()
prev = None

View File

@ -12,7 +12,6 @@ SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
ENV{MODALIAS}!="", IMPORT{builtin}="hwdb --subsystem=$env{SUBSYSTEM}"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="hwdb 'usb:v$attr{idVendor}p$attr{idProduct}'"
ACTION!="add", GOTO="default_end"