This commit is contained in:
Kovid Goyal 2010-01-02 20:30:20 -07:00
parent f061a40650
commit 45c6522ed8
3 changed files with 8 additions and 5 deletions

View File

@ -44,7 +44,12 @@ def debug(ioreg_to_tmp=False, buf=None):
try:
out = partial(prints, file=buf)
out('Version:', __version__)
wmi = Wmi =None
if iswindows:
wmi = __import__('wmi', globals(), locals(), [], -1)
Wmi = wmi.WMI(find_classes=False)
s = DeviceScanner()
s.wmi = Wmi
s.scan()
devices = (s.devices)
if not iswindows:
@ -54,10 +59,7 @@ def debug(ioreg_to_tmp=False, buf=None):
d[i] = hex(d[i])
out('USB devices on system:')
out(pprint.pformat(devices))
wmi = Wmi =None
if iswindows:
wmi = __import__('wmi', globals(), locals(), [], -1)
Wmi = wmi.WMI(find_classes=False)
drives = []
out('Drives detected:')
out('\t', '(ID, Partitions, Drive letter)')
@ -81,7 +83,6 @@ def debug(ioreg_to_tmp=False, buf=None):
ioreg = Device.run_ioreg()
ioreg = 'Output from mount:\n\n'+mount+'\n\n'+ioreg
connected_devices = []
s.wmi = Wmi
for dev in device_plugins():
owmi = getattr(dev, 'wmi', None)
dev.wmi = Wmi

View File

@ -222,6 +222,8 @@ class Device(DeviceConfig, DevicePlugin):
for pnp_id in pnp_id_iterator():
if self.windows_match_device(pnp_id, 'WINDOWS_MAIN_MEM'):
return True
if debug:
print '\tNo match found in:', pnp_id
return False
def open_windows(self):

View File

@ -177,7 +177,7 @@ class DeviceManager(Thread):
self.wmi = wmi.WMI(find_classes=False)
self.scanner.wmi = self.wmi
for x in self.devices:
x[0].wmi = self.wmi
x.wmi = self.wmi
try:
while self.keep_going:
self.detect_device()