Don't do a device scan when bus is blocked.
Properly handle capture file cancel path.
This commit is contained in:
parent
9014a20c65
commit
7435273ccb
|
@ -49,6 +49,7 @@ def capture_thr(sd, log_csv):
|
||||||
logcsv = csv.writer(csvfile)
|
logcsv = csv.writer(csvfile)
|
||||||
for token in c():
|
for token in c():
|
||||||
if token:
|
if token:
|
||||||
|
sd.dumpcount += 1
|
||||||
token.dump(logcsv, "csv") # write to CSV
|
token.dump(logcsv, "csv") # write to CSV
|
||||||
if StopCapture:
|
if StopCapture:
|
||||||
break
|
break
|
||||||
|
@ -341,7 +342,7 @@ class Frame(wx.Frame):
|
||||||
self.label_uptime.SetLabel("%d:%02d:%02d:%02d" % (days, hh, mm, ss))
|
self.label_uptime.SetLabel("%d:%02d:%02d:%02d" % (days, hh, mm, ss))
|
||||||
[d.Enable(True) for d in self.dynamic]
|
[d.Enable(True) for d in self.dynamic]
|
||||||
|
|
||||||
if not self.started:
|
if not self.started and (self.sd.sda == 1) and (self.sd.scl == 1):
|
||||||
devs = self.sd.scan(True)
|
devs = self.sd.scan(True)
|
||||||
for i,l in self.heat.items():
|
for i,l in self.heat.items():
|
||||||
self.hot(i, i in devs)
|
self.hot(i, i in devs)
|
||||||
|
@ -377,14 +378,17 @@ class Frame(wx.Frame):
|
||||||
openFileDialog.ShowModal()
|
openFileDialog.ShowModal()
|
||||||
self.log_csv = openFileDialog.GetPath()
|
self.log_csv = openFileDialog.GetPath()
|
||||||
openFileDialog.Destroy()
|
openFileDialog.Destroy()
|
||||||
|
if self.log_csv == u"":
|
||||||
|
e.EventObject.SetValue(False)
|
||||||
|
return
|
||||||
StopCapture = False
|
StopCapture = False
|
||||||
|
self.sd.dumpcount = 0
|
||||||
t = threading.Thread(target=capture_thr, args=(self.sd, self.log_csv))
|
t = threading.Thread(target=capture_thr, args=(self.sd, self.log_csv))
|
||||||
t.setDaemon(True)
|
t.setDaemon(True)
|
||||||
t.start()
|
t.start()
|
||||||
else:
|
else:
|
||||||
StopCapture = True
|
StopCapture = True
|
||||||
wx.MessageBox("Capture finished. Traffic written to " + self.log_csv, "Message" ,wx.OK | wx.ICON_INFORMATION)
|
wx.MessageBox("Capture finished. %d events written to \"%s\"" % (self.sd.dumpcount, self.log_csv), "Message", wx.OK | wx.ICON_INFORMATION)
|
||||||
while StopCapture:
|
while StopCapture:
|
||||||
pass
|
pass
|
||||||
[d.Enable(not cm) for d in self.dynamic]
|
[d.Enable(not cm) for d in self.dynamic]
|
||||||
|
|
Loading…
Reference in New Issue