Python Wiki

From Lantronix Wiki!
Revision as of 18:07, 13 November 2014 by Ltrxmg42 (talk | contribs) (Created page with " == Code samples == class pwDevice: def __init__(self): mac = commands.getoutput("ifconfig eth0| grep HWaddr | awk '{ print $5 }'").strip() self.mac = mac.translat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Code samples

class pwDevice:
	def __init__(self):
		mac = commands.getoutput("ifconfig eth0| grep HWaddr | awk '{ print $5 }'").strip()			
		self.mac = mac.translate(None,':')
		if os.path.exists('/ltrx_user/pwxcr/pwxc_hspa_import.xcr'):
			self.type = "PremierWave XC HSPA+"
			self.import_file = '/ltrx_user/pwxcr/pwxc_hspa_import.xcr'
		elif os.path.exists('/ltrx_user/pwxcr/pwxn_import.xcr'):
			self.type = "PremierWave XN"
			self.import_file = '/ltrx_user/pwxcr/pwxn_import.xcr'
		elif os.path.exists('/ltrx_user/pwxcr/pwen_import.xcr'):
			self.type = "PremierWave EN"
			self.import_file = '/ltrx_user/pwxcr/pwen_import.xcr'
		elif os.path.exists('/ltrx_user/pwxcr/pwse1000_import.xcr'):
			self.type = "PremierWave SE1000"
			self.import_file = '/ltrx_user/pwxcr/pwse1000_import.xcr'
		else:
			self.type = "Unknown"