Skip to content

Instantly share code, notes, and snippets.

@jgrar
Last active August 29, 2015 13:57
Show Gist options
  • Save jgrar/9896384 to your computer and use it in GitHub Desktop.
Save jgrar/9896384 to your computer and use it in GitHub Desktop.
import re
import subprocess
#device_re = "Bus \d{,3} Device \d{,3}: ID ([a-f0-9]+:[a-f0-9]+)"
device_re = "ID ([a-f0-9]+:[a-f0-9]+)"
df = subprocess.check_output("lsusb", shell=True)
for i in df.split('\n'):
if i:
print (re.findall(device_re, i, re.I))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment