Go to the documentation of this file.00001
00002
00003 import hrpiob_check_bin
00004 import binascii, tempfile, subprocess, os, shutil, stat
00005
00006 def hrpiob_iob():
00007 ret = True
00008 d_tmp = tempfile.mkdtemp()
00009 bin_name = os.path.join(d_tmp,"hrpiob_check")
00010
00011 f_bin = open(bin_name,'w')
00012 f_bin.write(binascii.unhexlify(hrpiob_check_bin.data))
00013 f_bin.close()
00014 st = os.stat(bin_name)
00015 os.chmod(bin_name, st.st_mode | stat.S_IEXEC)
00016
00017 subprocess.call("ldd %s" % (bin_name), shell=True)
00018 try:
00019 if subprocess.check_call(bin_name, shell=True) != 0:
00020 raise Exception("%s exit with 0"%(bin_name))
00021 except Exception, e:
00022 ret = False
00023 print " ** libhrpIo.so check failed ...", e.message
00024
00025 print " Check libhrpIo.so\t\t\t", ret, "\n"
00026
00027 shutil.rmtree(d_tmp)
00028 return ret
00029
00030