Commit 1436b8f
authored
python3/usb_scan: Skip empty lines in usb-policy.conf, add more comments (#6616)
Allow empty lines in usb-policy.conf (it's standard practice in similar
configuration files to allow both comments and empty lines, and it can
help readability quite a bit).
Previously, the script would fail in a rather unhelpful manner:
Traceback (most recent call last):
File "/opt/xensource/libexec/usb_scan.py", line 681, in <module>
pusbs = make_pusbs_list(devices, interfaces)
File "/opt/xensource/libexec/usb_scan.py", line 660, in make_pusbs_list
policy = Policy()
File "/opt/xensource/libexec/usb_scan.py", line 384, in __init__
self.parse_line(line)
File "/opt/xensource/libexec/usb_scan.py", line 444, in parse_line
if action.lower() == "allow":
UnboundLocalError: local variable 'action' referenced before assignment
See this forum thread for a user figuring this out on their own:
https://xcp-ng.org/forum/topic/11091/usb-passthrough-has-stopped-working-after-update-and-updating-usb-policy.conf/
Add some more comments to usb-policy.conf to help debug cases like the
above.File tree
3 files changed
+17
-0
lines changed- python3
- libexec
- tests
- scripts
3 files changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
424 | 428 | | |
425 | 429 | | |
426 | 430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| |||
0 commit comments