Change default Gammu Config file


Today i had problem with my server (use Linux Slackware) services for sms daemon (gammu). It didnt work as well when state of detection device get changed, from ttyUSB0 to ttyUSB3. So i came up some my best solution to create some condition by making secondary config file after i read this documentation and monitored dmesg log it will Change default Gammu Config file. From what i got in these log




and here is error message:


So, i need to create two different file configuration of gammu
primary file as default /etc/gammurc
secondary file /etc/gammurc-backup

In python scrip it would like this:

import gammu
sm = gammu.StateMachine()
sm.ReadConfig()
try:
  sm.Init()
except gammu.ERR_DEVICENOTEXIST:
  sm.ReadConfig(Filename = '/etc/gammurc-backup')
  sm.Init()

These code will make 2 condition , if default configuration ttyUSB2 exist then execute and if does not exist, it will using secondary configuration. It works.


Souce :
http://wammu.eu/docs/manual/python/examples.html

No comments:

Post a Comment

div>