Skip to content

Commit

Permalink
Added check to ensure disk exists in both volumes and mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
bridadan committed Sep 21, 2015
1 parent eac21bb commit 6ed2114
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mbed_lstools/lstools_darwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ def list_mbeds(self):

# {volume_id: {serial:, vendor_id:, product_id:, tty:}}
volumes = self.get_mbed_volumes()
#print 'volumes:', volumes

# {volume_id: mount_point}
mounts = self.get_mount_points()
#print "mounts:", mounts

volumes_keys = set(volumes.keys())
mounts_keys = set(mounts.keys())
intersection = volumes_keys & mounts_keys

valid_volumes = {}

for key in intersection:
valid_volumes[key] = volumes[key]

# put together all of that info into the expected format:
result = [
Expand All @@ -48,7 +55,7 @@ def list_mbeds(self):
'serial_port': volumes[v]['tty'],
'target_id': self.target_id(volumes[v]),
'platform_name': self.platform_name(self.target_id(volumes[v]))
} for v in volumes
} for v in valid_volumes
]

self.ERRORLEVEL_FLAG = 0
Expand Down

0 comments on commit 6ed2114

Please sign in to comment.