ui/crumbs/hig.py: fix run time error

Commit 094742bed2 re-implement the
function popen_read(). If there is no USB device, it crashes with
"ExecutionError: Execution of 'ls /dev/disk/by-id/usb*' failed with exit
code 2:"

Replace popen_read() way with glob module to get the USB devices.

(Bitbake rev: 0c43fe72e3c6a12ac19173d8cbbad81af21c2d85)

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kang Kai 2012-06-06 17:52:24 +08:00 committed by Richard Purdie
parent ac7b96420a
commit 0b6bb93558
1 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import glob
import gtk
import gobject
import hashlib
@ -806,7 +807,7 @@ class DeployImageDialog (CrumbsDialog):
def find_all_usb_devices(self):
usb_devs = [ os.readlink(u)
for u in self.popen_read('ls /dev/disk/by-id/usb*').split()
for u in glob.glob('/dev/disk/by-id/usb*')
if not re.search(r'part\d+', u) ]
return [ '%s' % u[u.rfind('/')+1:] for u in usb_devs ]