Example #1
0
def deviceList():
    iflist = []
    for iface in os.listdir(sysfs_path):
        if csapi.atoi(sysValue(sysfs_path, iface, "type")) == ARPHRD_ETHER:
            if os.path.exists(os.path.join(sysfs_path, iface, "wireless")):
                uid = _device_uid(iface)
                info = _device_info(uid)
                iflist.append("%s %s" % (uid, info))
    return "\n".join(iflist)
Example #2
0
def deviceList():
    iflist = []
    for iface in os.listdir(sysfs_path):
        if csapi.atoi(sysValue(sysfs_path, iface, "type")) == ARPHRD_ETHER:
            if not os.path.exists(os.path.join(sysfs_path, iface, "wireless")):
                uid = _device_uid(iface)
                info = _device_info(uid)
                iflist.append("%s %s" % (uid, info))
    return "\n".join(iflist)
Example #3
0
def _device_dev(uid):
    t = uid.rsplit("_", 1)
    if _device_check(t[1], uid):
        return t[1]
    iflist = []
    for iface in os.listdir(sysfs_path):
        if csapi.atoi(sysValue(sysfs_path, iface, "type")) == ARPHRD_ETHER:
            iflist.append(_device_uid(iface))
    for dev in iflist:
        if _device_check(dev, uid):
            return dev
    return None
Example #4
0
def _device_dev(uid):
    t = uid.rsplit("_", 1)
    if _device_check(t[1], uid):
        return t[1]
    iflist = []
    for iface in os.listdir(sysfs_path):
        if csapi.atoi(sysValue(sysfs_path, iface, "type")) == ARPHRD_ETHER:
            iflist.append(_device_uid(iface))
    for dev in iflist:
        if _device_check(dev, uid):
            return dev
    return None
Example #5
0
 def slotMask(self, addr):
     addr = unicode(addr)
     mask = self.netmask.edit
     if "." in addr:
         cl = csapi.atoi(addr.split(".", 1)[0])
         m = unicode(mask.text())
         if not self.maskOK(m):
             return
         if cl > 0 and cl < 127:
             mask.setText("255.0.0.0")
         elif cl > 127 and cl < 192:
             mask.setText("255.255.0.0")
         elif cl > 191 and cl < 224:
             mask.setText("255.255.255.0")
Example #6
0
    def stopPPPD(self, dev):
        """ Stop the connection and hangup the modem """

        try:
            f = open("/var/lock/LCK.." + dev, "r")
            pid = atoi(f.readline())
            f.close()
        except:
            return "Could not open lockfile"

        try:
            os.kill(pid, SIGTERM)
        except OSError:
            return "Could not stop the process"

        return "Killed"
Example #7
0
    def stopPPPD(self, dev):
        """ Stop the connection and hangup the modem """

        try:
            f = open("/var/lock/LCK.." + dev, "r")
            pid = atoi(f.readline())
            f.close()
        except:
            return "Could not open lockfile"

        try:
            os.kill(pid, SIGTERM)
        except OSError:
            return "Could not stop the process"

        return "Killed"
Example #8
0
def _device_info(uid):
    return "COM %d" % (atoi(uid[uid.find("S") + 1:]) + 1)
Example #9
0
def _device_info(uid):
    return "COM %d" % (atoi(uid[uid.find("S") + 1:]) + 1)