Skip to content

Commit f385482

Browse files
committed
bad JSON syntax, and multi-usb not implemented
1 parent 0fd752c commit f385482

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@ docs/_build/
5252

5353
# PyBuilder
5454
target/
55+
56+
.idea

install/usbkill.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
# Be warned! Other parties can copy your trusted usbid to another usb device!
4747
# use whitelist command and single space separation as follows:
4848
# whitelist = ["4c2a:d2b0", "0b2d:a2c4"]
49-
# To allow multiple (2 and 4) USBs with same id: [ ("4c2a:d2b0":2), ("0b2d:a2c4":4)] or
49+
# To allow multiple (2 and 4) USBs with same id: [ {"4c2a:d2b0":2}, {"0b2d:a2c4":4}] or
5050
# [ "4c2a:d2b0","4c2a:d2b0", "0b2d:a2c4", ..., "0b2d:a2c4" ] (be consistent)
5151
whitelist = []
5252

usbkill/usbkill.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ class DeviceCountSet(dict):
6868
def __init__(self, list):
6969
count = dict()
7070
for i in list:
71-
if i in count:
71+
if type(i) == dict:
72+
count[i.keys()[0]] = i.values()[0]
73+
elif i in count:
7274
count[i] += 1
7375
else:
7476
count[i] = 1
@@ -386,8 +388,8 @@ def startup_checks():
386388
# On first time use copy usbkill.ini to /etc/usebkill.ini
387389
# If dev-mode, always copy and don't remove old settings
388390
if not os.path.isfile(SETTINGS_FILE) or copy_settings:
389-
sources_path = os.path.dirname(os.path.realpath(__file__)) + '/'
390-
if not os.path.isfile(sources_path + "install/usbkill.ini"):
391+
sources_path = os.path.dirname(os.path.realpath(__file__))
392+
if not os.path.isfile(os.path.join(sources_path, "install/usbkill.ini")):
391393
sys.exit("\n[ERROR] You have lost your settings file. Get a new copy of the usbkill.ini and place it in /etc/ or in " + sources_path + "/\n")
392394
print("[NOTICE] Copying install/setting.ini to " + SETTINGS_FILE )
393395
os.system("cp " + sources_path + "install/usbkill.ini " + SETTINGS_FILE)

0 commit comments

Comments
 (0)