rfkill.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:PyRIC 作者: wraith-wireless 项目源码 文件源码
def hard_blocked(idx):
    """
     determines hard block state of device
     :param idx: rkill index
     :returns: True if device at idx is hard blocked, False otherwise
    """
    if not os.path.exists(os.path.join(spath,"rfkill{0}".format(idx))):
        raise pyric.error(errno.ENODEV,"No device at {0}".format(idx))
    fin = None
    try:
        fin = open(os.path.join(spath,"rfkill{0}".format(idx),'hard'),'r')
        return int(fin.read().strip()) == 1
    except IOError:
        raise pyric.error(errno.ENODEV,"No device at {0}".format(idx))
    except ValueError:
        raise pyric.error(pyric.EUNDEF,"Unexpected error")
    finally:
        if fin: fin.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号