当前位置: 首页>>代码示例>>Python>>正文


Python MobileDevice.init_device方法代码示例

本文整理汇总了Python中MobileDevice.MobileDevice.init_device方法的典型用法代码示例。如果您正苦于以下问题:Python MobileDevice.init_device方法的具体用法?Python MobileDevice.init_device怎么用?Python MobileDevice.init_device使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MobileDevice.MobileDevice的用法示例。


在下文中一共展示了MobileDevice.init_device方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()

        device_udi = self.dev_props["info.udi"]
        
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False

            device_tmp = props["info.udi"]
            
            if device_tmp.startswith(device_udi):
                if props.has_key("serial.device") :
                    ports.append(os.path.basename(props["serial.device"]))
            
        ports.sort()
        print ports
        
        if len(ports) >= 3 :
            self.set_property("data-device", "/dev/%s" % ports[0])
            self.set_property("conf-device", "/dev/%s" % ports[1])
            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Novatel"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            return False
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:36,代码来源:MobileDeviceNovatel.py

示例2: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
 def init_device(self) :
     ports = []
     devices =  self.hal_manager.GetAllDevices()
     for device in devices :
         device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
         try:
             props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
         except:
             return False
         
         if props.has_key("info.linux.driver") and props["info.linux.driver"] == "nozomi":
             if props.has_key("linux.sysfs_path") :
                 files = os.listdir(props["linux.sysfs_path"] + "/tty")
                 for f in files:
                     if f.startswith("noz"):
                         ports.append(f)
     ports.sort()
     print ports
     
     if len(ports) >= 3 :
         self.set_property("data-device", "/dev/%s" % ports[0])
         self.set_property("conf-device", "/dev/%s" % ports[2])
         self.set_property("device-icon", "network-wireless")
         self.pretty_name = "Option Nozomi"
         self.set_property("devices-autoconf", True)
         if not self.exists_conf :
             self.set_property("priority", "50")
         MobileDevice.init_device(self)
         return True
     else:
         return False
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:33,代码来源:MobileDeviceNozomi.py

示例3: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
 def init_device(self) :
     ports = []
     devices =  self.hal_manager.GetAllDevices()
     for device in devices :
         device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
         try:
             props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
         except:
             return False
         
         if props.has_key("info.parent") and props["info.parent"] == self.dev_props["info.udi"]:
             if props.has_key("usb.linux.sysfs_path") :
                 files = os.listdir(props["usb.linux.sysfs_path"])
                 for f in files:
                     if f.startswith("ttyUSB") :
                         ports.append(f)
     ports.sort()
     print ports
     
     if len(ports) == 4 :
         self.set_property("data-device", "/dev/%s" % ports[0])
         self.set_property("conf-device", "/dev/%s" % ports[2])
         self.pretty_name = "Option"
         self.set_property("devices-autoconf", True)
         if not self.exists_conf :
             self.set_property("priority", "50")
         MobileDevice.init_device(self)
         return True
     else:
         return False
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:32,代码来源:MobileDeviceOption.py

示例4: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
    def init_device(self):
        print 0
        port = "/dev/rfcomm%s" % os.path.basename(self.dev_props["linux.sysfs_path"]).strip("hci")
        
        parent_dev_dbus_obj =  self.dbus.get_object("org.freedesktop.Hal", self.dev_props["info.parent"])
        try:
            parent_props = parent_dev_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
        except:
            print "init error in Bluetooth device"
            self.set_property("data-device", port)
            self.set_property("devices-autoconf", True)
            MobileDevice.init_device(self)
            return True

        if parent_props.has_key("info.subsystem") :
            if parent_props["info.subsystem"] == "usb_device" :
                if parent_props.has_key("info.product") :
                    self.pretty_name = parent_props["info.product"]
                    if self.pretty_name == "Bluetooth Host Controller Interface":
                        self.pretty_name = "Bluetooth"
                    
        
        self.set_property("data-device", port)
        self.set_property("devices-autoconf", True)
        self.set_property("device-icon", "bluetooth")

        MobileDevice.init_device(self)
        
        return True
开发者ID:oier,项目名称:mobile-manager,代码行数:31,代码来源:MobileDeviceBluetooth.py

示例5: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()

        device_udi = self.dev_props["info.udi"]
        
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False

            device_tmp = props["info.udi"]
            
            if device_tmp.startswith(device_udi):
                if props.has_key("serial.device") :
                    ports.append(os.path.basename(props["serial.device"]))

        ports = dict(map(lambda i: (i,1),ports)).keys()
        ports.sort()
        print ports

        dev = (self.dev_props["usb_device.product_id"],
               self.dev_props["usb_device.vendor_id"])
        
        if len(ports) >= 3 :
            if dev == (0x7001, 0x1410) and len(ports) != 4 :
                return False
            
            if dev == (0x7001, 0x1410) :
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[1])
            else:
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[1])
                
            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Novatel"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            if dev == (0x7001, 0x1410) and len(ports) == 1 :            
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[0][:-1] + str(int(ports[0][-1]) + 1))
                print "data --> %s" % self.get_property("data-device")
                print "conf --> %s" % self.get_property("conf-device")
                self.set_property("device-icon", "network-wireless")
                self.pretty_name = "Novatel"
                self.set_property("devices-autoconf", True)
                if not self.exists_conf :
                    self.set_property("priority", "50")
                MobileDevice.init_device(self)
                return True
            
            return False
开发者ID:oier,项目名称:mobile-manager,代码行数:61,代码来源:MobileDeviceNovatel.py

示例6: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
 def init_device(self):
     if self.device_port != None:
         self.set_property("data-device", self.device_port)
         self.set_property("devices-autoconf", True)
         MobileDevice.init_device(self)
         return True
     else:
         return False
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:10,代码来源:MobileDeviceUSB.py

示例7: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False
            
            if props.has_key("info.parent") and props["info.parent"] == self.dev_props["info.udi"]:
                if props.has_key("usb.linux.sysfs_path") :
                    files = os.listdir(props["usb.linux.sysfs_path"])
                    for f in files:
                        if f.startswith("ttyUSB"):
                            ports.append(f)
        
        if len(ports) == 0 :
            device_udi = self.dev_props["info.udi"]
            for device in devices :
                device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
                try:
                    props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
                except:
                    return False
    
                device_tmp = props["info.udi"]
                
                if device_tmp.startswith(device_udi):
                    if props.has_key("serial.device") :
                        ports.append(os.path.basename(props["serial.device"]))

            ports = dict(map(lambda i: (i,1),ports)).keys()
        
        ports.sort()
        print "-------------> %s" % ports
        dev = (self.dev_props["usb_device.product_id"],
               self.dev_props["usb_device.vendor_id"])
        
        if len(ports) >= 3 :
            if dev == (0x7501, 0xaf0) :
                self.set_property("data-device", "/dev/%s" % ports[3])
                self.set_property("conf-device", "/dev/%s" % ports[2])
            else:
                self.set_property("data-device", "/dev/%s" % ports[0])
                self.set_property("conf-device", "/dev/%s" % ports[2])
                
            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Option"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            return False
开发者ID:oier,项目名称:mobile-manager,代码行数:58,代码来源:MobileDeviceOption.py

示例8: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
 def init_device(self):
     if self.device_port != None:
         self.set_property("data-device", self.dev_props["serial.device"] )
         self.pretty_name = "Serial Port (%s or %s for Win users)" % (os.path.basename( self.dev_props["serial.device"]),
                                                                      "COM%i" % (int( self.dev_props["serial.device"][-1])+1))
         self.set_property("devices-autoconf", True)
         MobileDevice.init_device(self)
         return True
     else:
         return False
开发者ID:oier,项目名称:mobile-manager,代码行数:12,代码来源:MobileDeviceSerial.py

示例9: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
 def init_device(self):
     if self.device_port != None:
         self.set_property("data-device", self.device_port)
         self.set_property("conf-device", self.device_port)
         self.set_property("devices-autoconf", True)
         self.set_property("device-icon", "stock_cell-phone")
         #self.set_property("priority", "50")
         MobileDevice.init_device(self)
         return True
     else:
         return False
开发者ID:oier,项目名称:mobile-manager,代码行数:13,代码来源:MobileDeviceUSB.py

示例10: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
    def init_device(self) :
        ports = []
        devices =  self.hal_manager.GetAllDevices()

        device_udi = self.dev_props["info.udi"]
        
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False

            device_tmp = props["info.udi"]
            
            if device_tmp.startswith(device_udi):
                if props.has_key("serial.device") :
                    ports.append(os.path.basename(props["serial.device"]))

        ports = list(set(ports))
        ports.sort()

        dev = (self.dev_props["usb_device.product_id"],
               self.dev_props["usb_device.vendor_id"])
        
        if len(ports) >= 3 :
            if dev == (0x68a3,0x1199) and len(ports) >= 4 :
                self.set_property("conf-device", "/dev/%s" % ports[2])
                self.set_property("data-device", "/dev/%s" % ports[3])
            elif dev == (0x6890,0x1199) and len(ports) >= 4 :
                self.set_property("conf-device", "/dev/%s" % ports[3])
                self.set_property("data-device", "/dev/%s" % ports[4])
            else:
                self.set_property("conf-device", "/dev/%s" % ports[2])
                self.set_property("data-device", "/dev/%s" % ports[0])

            print "data ------------> %s" % self.get_property("data-device")
            print "conf ------------> %s" % self.get_property("conf-device")

            self.set_property("device-icon", "network-wireless")
            self.pretty_name = "Sierra"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            return False
开发者ID:oier,项目名称:mobile-manager,代码行数:50,代码来源:MobileDeviceSierra.py

示例11: init_device

# 需要导入模块: from MobileDevice import MobileDevice [as 别名]
# 或者: from MobileDevice.MobileDevice import init_device [as 别名]
    def init_device(self) :
        t0 = time.time()
        mainloop =  gobject.MainLoop(is_running=True)
        context = mainloop.get_context()

        while time.time() - t0 <= 10.0 :
            if context.pending() :
                context.iteration()
        
        ports = []
        devices =  self.hal_manager.GetAllDevices()
        for device in devices :
            device_dbus_obj = self.dbus.get_object("org.freedesktop.Hal", device)
            try:
                props = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device")
            except:
                return False
            
            if props.has_key("info.parent") and props["info.parent"] == self.dev_props["info.udi"]:
                if props.has_key("usb.linux.sysfs_path") :
                    files = os.listdir(props["usb.linux.sysfs_path"])
                    for f in files:
                        if f.startswith("ttyUSB") :
                            ports.append(f)
        ports.sort()
        print ports

        dev = (self.dev_props["usb_device.product_id"],
               self.dev_props["usb_device.vendor_id"])

        self.set_property("device-icon", "network-wireless")
        
        if (dev == (0x1004,0x12d1) and len(ports) == 4) or (dev == (0x1001,0x12d1) and len(ports) >= 3):
            self.set_property("data-device", "/dev/%s" % ports[0])
            self.set_property("conf-device", "/dev/%s" % ports[2])
            self.pretty_name = "Huawei"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        elif dev == (0x1003,0x12d1) and len(ports) >= 2 :
            self.set_property("data-device", "/dev/%s" % ports[0])
            self.set_property("conf-device", "/dev/%s" % ports[1])
            self.pretty_name = "Huawei"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        elif dev == (0x1406,0x12d1) and len(ports) >= 2 :
            self.set_property("data-device", "/dev/%s" % ports[0])
            self.set_property("conf-device", "/dev/%s" % ports[1])
            self.pretty_name = "Huawei"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        elif dev == (0x1417,0x12d1) and len(ports) >= 2 :
            self.set_property("data-device", "/dev/%s" % ports[0])
            self.set_property("conf-device", "/dev/%s" % ports[3])
            self.pretty_name = "Huawei"
            self.set_property("devices-autoconf", True)
            if not self.exists_conf :
                self.set_property("priority", "50")
            MobileDevice.init_device(self)
            return True
        else:
            return False
开发者ID:oier,项目名称:mobile-manager,代码行数:72,代码来源:MobileDeviceHuawei.py


注:本文中的MobileDevice.MobileDevice.init_device方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。