SettingsGUI - Initial import
git-svn-id: http://www.neo1973-germany.de/svn@35 46df4e5c-bc4e-4628-a0fc-830ba316316d
BIN
SettingsGUI/trunk/docs/icon/2spaners-001-128.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
SettingsGUI/trunk/docs/icon/2spaners-001-48.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
SettingsGUI/trunk/docs/icon/2spaners-001.blend
Normal file
BIN
SettingsGUI/trunk/docs/icon/2spaners-001.jpeg.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
SettingsGUI/trunk/docs/icon/SettingsGUI-48.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.3.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.6-audio.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.6-gprs.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.6-gsm.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.6-scaled.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.6-screen_.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.6.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.7-audio.png
Normal file
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.7-gprs.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.7-gsm.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-0.7-screen.png
Normal file
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 158 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-Backlight.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/SettingsGUI-GSM-0_5.png.png
Normal file
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 31 KiB |
BIN
SettingsGUI/trunk/docs/screenshots/audio-0_4.png
Normal file
After Width: | Height: | Size: 30 KiB |
11
SettingsGUI/trunk/docs/settingsgui.desktop
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Version=0.7
|
||||
Type=Application
|
||||
Name=SettingsGUI
|
||||
Comment=Settings Utility
|
||||
Categories=Utility
|
||||
Exec=settingsgui
|
||||
Icon=SettingsGUI-48.png
|
||||
Terminal=false
|
||||
SingleInstance=true
|
||||
|
340
SettingsGUI/trunk/src/COPYING
Normal file
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
41
SettingsGUI/trunk/src/settings
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/python
|
||||
"""
|
||||
* settings-gui.py - script to start the application
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import gtk
|
||||
from settingsgui.SettingsGUI import *
|
||||
|
||||
def main():
|
||||
gobject.timeout_add(500, SettingGUI.create_UI) # every 1/2 second
|
||||
try:
|
||||
if gtk.gtk_version[0] == 2:
|
||||
gtk.gdk.threads_init()
|
||||
except:
|
||||
pass
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.main()
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
if (__name__ == '__main__'):
|
||||
gtk.gdk.threads_init()
|
||||
gtk.gdk.threads_enter()
|
||||
|
||||
SettingGUI = SettingsGUI()
|
||||
main()
|
160
SettingsGUI/trunk/src/settingsgui/AudioPanel.py
Normal file
|
@ -0,0 +1,160 @@
|
|||
"""
|
||||
* AudioPanel.py - SettingsGUI - Audio Settings
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import gtk
|
||||
import SysFSAccess
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
from GlobalConfiguration import *
|
||||
|
||||
|
||||
class AudioPanel(gtk.VBox):
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self, False, 0)
|
||||
self.muted = 0
|
||||
self.volume_scales = {}
|
||||
self.create_notebook_page()
|
||||
|
||||
def profile_changed_callback(self, box):
|
||||
os.system("/usr/sbin/alsactl -f %s%s restore" % (
|
||||
ALSA_STATES_DIR, ALSA_ENTRYS[box.get_active_text()]))
|
||||
print "called [%s]" % "/usr/sbin/alsactl -f %s%s restore" % (
|
||||
ALSA_STATES_DIR, ALSA_ENTRYS[box.get_active_text()])
|
||||
|
||||
## update scales
|
||||
for entry in self.volume_scales:
|
||||
self.volume_scales[entry].value = self.get_volume(entry)
|
||||
|
||||
## callback save from button
|
||||
def save_profile(self, widget):
|
||||
os.system("/usr/sbin/alsactl -f %s%s store" % (
|
||||
ALSA_STATES_DIR, ALSA_ENTRYS[self.profile_combo.get_active_text()]))
|
||||
print "called [%s]" % "/usr/sbin/alsactl -f %s%s store" % (
|
||||
ALSA_STATES_DIR, ALSA_ENTRYS[self.profile_combo.get_active_text()])
|
||||
|
||||
|
||||
## called when a scaled was touched
|
||||
def volume_changed_callback(self, scale, channel):
|
||||
self.set_volume(channel, scale.value)
|
||||
|
||||
## callback from mute button
|
||||
def mute_audio(self, widget):
|
||||
if self.muted != 1:
|
||||
self.set_volume(ALSA_CHANNEL_RIGHT, 0)
|
||||
self.set_volume(ALSA_CHANNEL_LEFT, 0)
|
||||
self.set_volume(ALSA_CHANNEL_MONO, 0)
|
||||
self.mute_tbn.set_label("Unmute")
|
||||
self.muted = 1
|
||||
else:
|
||||
for scale in self.volume_scales:
|
||||
self.set_volume(scale, self.volume_scales[scale].value)
|
||||
self.mute_tbn.set_label("Mute")
|
||||
self.muted = 0
|
||||
|
||||
## will use amixer for now - so we dont depend on python-alsa which is not
|
||||
## in OpenEmbedded now...
|
||||
def set_volume(self, chan_id, value):
|
||||
amix_ostream = os.popen("%s cset numid=%d %d" %(ALSA_AMIXER, chan_id, value))
|
||||
return True;
|
||||
|
||||
def read_alsa_mixer(self):
|
||||
amix_ostream = os.popen("%s" %ALSA_AMIXER)
|
||||
mixer = {} ## dict of mixer controls
|
||||
mixer_entry = {}
|
||||
for line in amix_ostream.read().split('\n'):
|
||||
if not line.startswith(" "):
|
||||
if len(line.split("'")) >= 2:
|
||||
mixer["%s" % line.split("'")[1]] = {}
|
||||
mixer_entry = mixer["%s" % line.split("'")[1]]
|
||||
|
||||
|
||||
## will use amixer for now - so we dont depend on python-alsa which is not
|
||||
## in OpenEmbedded now...
|
||||
def get_volume(self, chan_id):
|
||||
amix_ostream = os.popen("%s cget numid=%d" %(ALSA_AMIXER, chan_id))
|
||||
# ToDo - parse everything!
|
||||
amix_out = amix_ostream.readline()
|
||||
amix_out = amix_ostream.readline()
|
||||
amix_out = amix_ostream.readline()
|
||||
if amix_out.find("value") >= 0:
|
||||
return int(amix_out.split('=')[1])
|
||||
return 0;
|
||||
|
||||
def get_max_volume(self, chan_id):
|
||||
amix_ostream = os.popen("%s cget numid=%d" %(ALSA_AMIXER, chan_id))
|
||||
# ToDo - parse everything!
|
||||
amix_out = amix_ostream.readline()
|
||||
amix_out = amix_ostream.readline()
|
||||
for value_entry in amix_out.split(','):
|
||||
if value_entry.find("max") >= 0:
|
||||
return int(value_entry.split('=')[1])
|
||||
return 100;
|
||||
|
||||
def create_notebook_page(self):
|
||||
audio_channels = [
|
||||
["Right Speaker", ALSA_CHANNEL_RIGHT],
|
||||
["Left Speaker", ALSA_CHANNEL_LEFT],
|
||||
["Mono Output", ALSA_CHANNEL_MONO],
|
||||
]
|
||||
self.set_border_width(0)
|
||||
|
||||
# profile selector dropdown box
|
||||
upper_box = gtk.HBox()
|
||||
self.profile_combo = gtk.combo_box_new_text()
|
||||
for entry in ALSA_ENTRYS.keys():
|
||||
self.profile_combo.append_text(entry)
|
||||
self.profile_combo.connect('changed', self.profile_changed_callback)
|
||||
upper_box.add(self.profile_combo)
|
||||
|
||||
self.mute_btn = gtk.Button("Mute")
|
||||
self.mute_btn.connect("clicked", self.mute_audio)
|
||||
upper_box.pack_start(self.mute_btn, False, False, 0)
|
||||
|
||||
self.add_profile_btn = gtk.Button()
|
||||
image = gtk.Image()
|
||||
image.set_from_icon_name("gtk-save", gtk.ICON_SIZE_MENU)
|
||||
self.add_profile_btn.add(image)
|
||||
self.add_profile_btn.connect('clicked', self.save_profile)
|
||||
upper_box.pack_start(self.add_profile_btn, False, False, 0)
|
||||
|
||||
self.pack_start(upper_box, False, False, 0)
|
||||
|
||||
# volume control
|
||||
for channel in audio_channels:
|
||||
init_volume = self.get_volume(channel[1])
|
||||
|
||||
frame = gtk.Frame(channel[0])
|
||||
self.pack_start(frame, False, True, 0)
|
||||
|
||||
max_value = self.get_max_volume(channel[1])
|
||||
scale_adj = gtk.Adjustment(init_volume, 0.0, max_value, 1.0, 1.0, 0.0)
|
||||
scale_adj.connect("value_changed", self.volume_changed_callback, channel[1])
|
||||
self.volume_scales.update({channel[1]: scale_adj})
|
||||
volume_scale = gtk.HScale(scale_adj)
|
||||
volume_scale.set_digits(0)
|
||||
frame.add(volume_scale)
|
||||
# self.pack_start(volume_scale, False, False, 0)
|
||||
|
||||
self.show_all()
|
||||
|
||||
### ToDo.
|
||||
|
323
SettingsGUI/trunk/src/settingsgui/BluetoothPanel.py
Normal file
|
@ -0,0 +1,323 @@
|
|||
"""
|
||||
* BluetoothPanel.py - SettingsGUI - Bluetooth Settings
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import gtk
|
||||
import SysFSAccess
|
||||
from GlobalConfiguration import *
|
||||
from SysFSAccess import *
|
||||
from ProcessInterface import *
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
#from settingsgui.SysFSAccess import *
|
||||
#from settingsgui.ProcessInterface import *
|
||||
|
||||
class BluetoothPanel(gtk.VBox):
|
||||
"""
|
||||
Settings for the Bluetooth Module of GTA01
|
||||
"""
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self, False, 0)
|
||||
self.address = ""
|
||||
self.scan_for_bt_peers = True
|
||||
self.create_notebook_page()
|
||||
|
||||
def create_notebook_page(self):
|
||||
self.set_border_width(0)
|
||||
|
||||
## Power State of Bluetooth Module
|
||||
cell_frame = gtk.Frame("Bluetooth State")
|
||||
upper_box = gtk.HBox()
|
||||
upper_box.set_border_width(15)
|
||||
|
||||
# power
|
||||
self.power_state_cbtn = gtk.CheckButton("Powered")
|
||||
self.power_state_cbtn.set_sensitive(1)
|
||||
self.power_state_cbtn.connect('pressed', \
|
||||
lambda *w: self.power_state_cbtn.set_inconsistent(1))
|
||||
self.power_state_cbtn.connect('released', self.toggle_power)
|
||||
upper_box.pack_start(self.power_state_cbtn, True, True, 0)
|
||||
|
||||
# discoverability
|
||||
self.visible_state_cbtn = gtk.CheckButton("Visible")
|
||||
self.visible_state_cbtn.set_sensitive(1)
|
||||
#self.visible_state_cbtn.connect('pressed', \
|
||||
# lambda *w: self.visible_state_cbtn.set_inconsistent(1))
|
||||
self.visible_state_cbtn.connect('released', \
|
||||
lambda *w: self.visible_state_cbtn.set_active(1))
|
||||
upper_box.pack_start(self.visible_state_cbtn, True, True, 0)
|
||||
|
||||
# pand
|
||||
self.pand_state_cbtn = gtk.CheckButton("Allow PAN")
|
||||
self.pand_state_cbtn.set_sensitive(1)
|
||||
self.pand_state_cbtn.connect('pressed', \
|
||||
lambda *w: self.pand_state_cbtn.set_inconsistent(1))
|
||||
self.pand_state_cbtn.connect('released', self.toggle_listen_pand)
|
||||
upper_box.pack_start(self.pand_state_cbtn, True, True, 0)
|
||||
|
||||
cell_frame.add(upper_box)
|
||||
self.pack_start(cell_frame, False, False, 0)
|
||||
|
||||
## Info on BT state
|
||||
info_frame = gtk.Frame("Bluetooth Informations")
|
||||
info_box = gtk.VBox()
|
||||
info_box.set_border_width(15)
|
||||
self.address_label = gtk.Label("Bluetooth Address: %s" % self.get_address())
|
||||
self.ip_address_label = gtk.Label("IP Address: %s" % self.get_ip_address())
|
||||
info_box.add(self.address_label)
|
||||
info_box.add(self.ip_address_label)
|
||||
info_frame.add(info_box)
|
||||
self.pack_start(info_frame, False, True, 1)
|
||||
|
||||
|
||||
scan_frame = gtk.Frame("Devices in range")
|
||||
scan_frame_box = gtk.VBox()
|
||||
scan_frame_box.set_border_width(15)
|
||||
(scroll_win, self.tree_view1, self.list_store1) = \
|
||||
self.make_list_view(3, \
|
||||
["Name", "Address", "PAN Link"], \
|
||||
["text", "text", "toggle"])
|
||||
scan_frame_box.pack_start(scroll_win, True, True, 0)
|
||||
|
||||
# self.add_scan_list_entry
|
||||
self.list_store1.append(("Scanning for Peers", "", False))
|
||||
self.update_infos()
|
||||
self.update_list(None)
|
||||
|
||||
|
||||
scan_btn_box = gtk.HBox()
|
||||
update_btn = gtk.Button("Update\nList")
|
||||
update_btn.connect('clicked', self.update_list)
|
||||
scan_btn_box.add(update_btn)
|
||||
connect_btn = gtk.Button("Connect\n(PAN)")
|
||||
connect_btn.connect('clicked', self.connect_to_peer)
|
||||
scan_btn_box.add(connect_btn)
|
||||
scan_frame_box.pack_start(scan_btn_box, False, True, 0)
|
||||
scan_frame.add(scan_frame_box)
|
||||
|
||||
self.pack_start(scan_frame, True, True, 0)
|
||||
|
||||
# settings powerstate as last operation to ensure existence of all
|
||||
# widgets
|
||||
if self.get_power_state():
|
||||
self.power_state_cbtn.set_active(True)
|
||||
self.visible_state_cbtn.set_active(True)
|
||||
self.toggle_power(None)
|
||||
else:
|
||||
self.power_state_cbtn.set_active(False)
|
||||
self.visible_state_cbtn.set_active(False)
|
||||
|
||||
## finish notebook page creation
|
||||
self.show_all()
|
||||
|
||||
################################################################################
|
||||
######################### build GUI helper #####################################
|
||||
################################################################################
|
||||
## we allow one toggle -for fixed (text, text, toggle)
|
||||
def make_list_view(self, number, names, type = ["text", "text", "text"]):
|
||||
scroll_win = gtk.ScrolledWindow()
|
||||
scroll_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
|
||||
#try:
|
||||
if type.index("toggle") >= 0:
|
||||
list_store = gtk.ListStore(str, str, 'gboolean')#gobject.TYPE_BOOLEAN)
|
||||
#except:
|
||||
# list_store = gtk.ListStore(*(str,) * number)
|
||||
|
||||
tree_view = gtk.TreeView(list_store)
|
||||
cell = gtk.CellRendererText()
|
||||
cell.set_property('editable', False)
|
||||
cell_toggle = gtk.CellRendererToggle()
|
||||
cell_toggle.set_property('activatable', True)
|
||||
|
||||
tvcolumn = []
|
||||
for i in range(number):
|
||||
if type[i] == "text":
|
||||
tvcolumn.append(gtk.TreeViewColumn(names[i], cell, markup=i))
|
||||
if type[i] == "toggle":
|
||||
toggle_column = gtk.TreeViewColumn(names[i], cell_toggle)
|
||||
tvcolumn.append(toggle_column)
|
||||
toggle_column.add_attribute(cell_toggle, attribute = "active", \
|
||||
column = 2)
|
||||
tree_view.append_column(tvcolumn[i])
|
||||
tvcolumn[i].set_sort_column_id(i)
|
||||
tvcolumn[i].set_resizable(True)
|
||||
|
||||
scroll_win.add(tree_view)
|
||||
return (scroll_win, tree_view, list_store)
|
||||
|
||||
################################################################################
|
||||
####################### Callbacks from GUI #####################################
|
||||
################################################################################
|
||||
def toggle_power(self, event):
|
||||
print "Toggleing Power state!"
|
||||
if not self.get_power_state():
|
||||
set_sysfs_value(SYSFS_ENTRY_BLUETOOTH_POWER, 1)
|
||||
self.list_store1.append(("Scanning for Peers", "", False))
|
||||
else:
|
||||
set_sysfs_value(SYSFS_ENTRY_BLUETOOTH_POWER, 0)
|
||||
|
||||
if self.power_state_cbtn.get_active() != self.get_power_state():
|
||||
self.power_state_cbtn.get_active()
|
||||
|
||||
## have to wait for async init :-( - TODO - make updates async.
|
||||
time.sleep(2)
|
||||
self.update_infos()
|
||||
self.update_list(None)
|
||||
|
||||
## for now we are alyways visible when power is on
|
||||
self.visible_state_cbtn.set_active(self.get_power_state())
|
||||
|
||||
self.power_state_cbtn.set_inconsistent(0)
|
||||
|
||||
def toggle_listen_pand(self, event):
|
||||
if self.pand_state_cbtn.get_active():
|
||||
print "Starting pand [pand -s]"
|
||||
os.system("pand -s")
|
||||
else:
|
||||
print "pand already listening for connections"
|
||||
self.pand_state_cbtn.set_active(1)
|
||||
self.pand_state_cbtn.set_inconsistent(0)
|
||||
|
||||
def get_power_state(self):
|
||||
state = get_sysfs_value(SYSFS_ENTRY_BLUETOOTH_POWER)[0]
|
||||
print "Powerstate is [%s]" %state
|
||||
if state.isdigit():
|
||||
return int(state)
|
||||
else:
|
||||
return 0
|
||||
|
||||
def connect_to_peer(self, event):
|
||||
|
||||
def call_cmd(string):
|
||||
print("calling command [%s]" % string)
|
||||
os.system(string)
|
||||
|
||||
## get selected entry
|
||||
if len(self.address) <= 0:
|
||||
return
|
||||
(model, model_iter) = self.tree_view1.get_selection().get_selected()
|
||||
if model_iter >= 1:
|
||||
name = model.get_value(model_iter, 0) # column is first (name)
|
||||
addr = model.get_value(model_iter, 1) # column is second (adr)
|
||||
call_cmd("pand -c %s" % addr)
|
||||
## convert last number of addr to decimal and user as last ip number
|
||||
call_cmd("ip a add 10.0.0.%s/24 dev bnep0" % \
|
||||
int(self.address.split(":")[-1], 16))
|
||||
## set main ip of bnep0 (in case a different ip was set)
|
||||
call_cmd("ifconfig bnep0 10.0.0.%s" % \
|
||||
int(self.address.split(":")[-1], 16))
|
||||
## set 10.0.0.1 to default GW - won't work if GW is set already
|
||||
call_cmd("ip r add default via 10.0.0.1")
|
||||
time.sleep(1)
|
||||
self.update_infos()
|
||||
|
||||
|
||||
def update_list(self, event):
|
||||
self.hcitool = ProcessInterface("%s scan" % HCITOOL_CMD)
|
||||
self.list_store1.clear()
|
||||
self.hcitool.register_event_handler(":", self.add_scan_list_entry)
|
||||
|
||||
pand_list_tool = ProcessInterface("pand -l")
|
||||
time.sleep(1) ## wait for command to compute
|
||||
output = pand_list_tool.read_from_process()
|
||||
|
||||
self.connected_peers = []
|
||||
for line in output.split("\n"):
|
||||
if len(line.split(" ")) > 1:
|
||||
self.connected_peers.append(line.split(" ")[1])
|
||||
|
||||
################################################################################
|
||||
#################### subprocess callbacks (outputs) ############################
|
||||
################################################################################
|
||||
|
||||
def add_scan_list_entry(self, string):
|
||||
if string.find(":") >= 0:
|
||||
print ("new")
|
||||
try:
|
||||
self.connected_peers.index(string.strip().split("\t")[0])
|
||||
found = True ## we've had no exception
|
||||
except:
|
||||
found = False
|
||||
print ("append: [%s,%s,%s]" % (string.strip().split("\t")[1], \
|
||||
string.strip().split("\t")[0], found))
|
||||
self.list_store1.append((string.strip().split("\t")[1], \
|
||||
string.strip().split("\t")[0], found))
|
||||
|
||||
def ip_address_changed(self, string):
|
||||
# print "output of get_ip_address: [%s]" % string
|
||||
if len(string.split("inet addr:")) > 1:
|
||||
self.address_label.set_text("Bluetooth Address: %s" % \
|
||||
string.split("inet addr:")[1].split(" ")[0].strip())
|
||||
|
||||
|
||||
def bt_address_changed(self, string):
|
||||
# print "output of get_address: [%s]" % string
|
||||
if string.find("BD Address: "):
|
||||
if len(string.split("BD Address: ")) > 1 and \
|
||||
len(string.split("BD Address: ")[1].split(" ")) > 1:
|
||||
self.address = string.split("BD Address: ")[1].split(" ")[0]
|
||||
self.ip_address_label.set_text("Address: %s" % \
|
||||
string.split("BD Address: ")[1].split(" ")[0])
|
||||
else:
|
||||
self.ip_address_label.set_text("Address: offline")
|
||||
self.ip_address_label.set_text("Address: unknown")
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
####################### Interface to bluez tools ###############################
|
||||
################################################################################
|
||||
def update_infos(self):
|
||||
self.address_label.set_text("Bluetooth Address: %s" % self.get_address())
|
||||
self.ip_address_label = gtk.Label("IP Address: %s" % self.get_ip_address())
|
||||
|
||||
def get_ip_address(self):
|
||||
if len(self.address) <= 0:
|
||||
return "none"
|
||||
else: ## todo mind more than one device
|
||||
ifconfig = ProcessInterface("ifconfig bnep0")
|
||||
time.sleep(1) ## wait for command to compute
|
||||
output = ifconfig.read_from_process()
|
||||
# print "output of get_ip_address: [%s]" % output
|
||||
if len(output.split("inet addr:")) > 1:
|
||||
return output.split("inet addr:")[1].split(" ")[0].strip()
|
||||
|
||||
def get_address(self):
|
||||
hciconfig = ProcessInterface("%s %s" % (HCICONFIG_CMD, BLUETOOTH_DEVICE))
|
||||
time.sleep(1) ## wait for command to compute
|
||||
output = hciconfig.read_from_process()
|
||||
|
||||
# print "output of get_address: [%s]" % output
|
||||
# hciconfig.close_process() ## has no effect anyway :-( TODO - fix
|
||||
if output.find("BD Address: "):
|
||||
if len(output.split("BD Address: ")) > 1 and \
|
||||
len(output.split("BD Address: ")[1].split(" ")) > 1:
|
||||
self.address = output.split("BD Address: ")[1].split(" ")[0]
|
||||
return output.split("BD Address: ")[1].split(" ")[0]
|
||||
else:
|
||||
return "offline"
|
||||
return "unknown"
|
||||
|
||||
def get_features(self):
|
||||
"""using the hciconfig tool to get the list of supported features"""
|
||||
|
471
SettingsGUI/trunk/src/settingsgui/GPRSPanel.py
Normal file
|
@ -0,0 +1,471 @@
|
|||
"""
|
||||
* GPRSPanel.py - SettingsGUI - GPRS Settings
|
||||
*
|
||||
* GPRS Connection Settings - using pppd until the LDISC interface is
|
||||
* finished
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil # to create a backup of pppd config files
|
||||
import threading
|
||||
import time
|
||||
import gtk
|
||||
import gobject
|
||||
|
||||
from ProcessInterface import *
|
||||
from SysFSAccess import *
|
||||
from GSMPanel import *
|
||||
from GlobalConfiguration import *
|
||||
from pppdConfigParser import *
|
||||
|
||||
#from settingsgui.ProcessInterface import *
|
||||
#from settingsgui.SysFSAccess import *
|
||||
#from settingsgui.GSMPanel import *
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
#from settingsgui.pppdConfigParser import *
|
||||
|
||||
## ToDo
|
||||
## from GSMPanel import GSMPanel ## to reach the operator name
|
||||
## (name peer like operator)
|
||||
|
||||
|
||||
################################################################################
|
||||
# lots of methods - will devide them into block with big comments between them #
|
||||
################################################################################
|
||||
class GPRSPanel(gtk.VBox):
|
||||
def __init__(self, GSM_Panel):
|
||||
self.GSM_Panel = GSM_Panel
|
||||
gtk.VBox.__init__(self, False, 0)
|
||||
self.peer_entries = {}
|
||||
self.entry_dict = {}
|
||||
self.local_ip = ""
|
||||
self.remote_ip = ""
|
||||
self.nameserver_ip = ""
|
||||
|
||||
self.peer_entries.update(self.find_peers())
|
||||
self.create_notebook_page()
|
||||
self.peer_changed_callback(self.peer_combo)
|
||||
self.set_state("disconnected")
|
||||
|
||||
################################################################################
|
||||
############ search system for ppp peers (pppd config files) ###################
|
||||
################################################################################
|
||||
def find_peers(self):
|
||||
new_dict = {}
|
||||
|
||||
if not os.path.exists(os.path.expanduser(PPP_PATH_TO_USER_PEERS)):
|
||||
os.makedirs(os.path.expanduser(PPP_PATH_TO_USER_PEERS))
|
||||
print "created %s" % os.path.expanduser(PPP_PATH_TO_USER_PEERS)
|
||||
else:
|
||||
try:
|
||||
for key in os.listdir(
|
||||
os.path.expanduser(PPP_PATH_TO_USER_PEERS)):
|
||||
|
||||
if (key[-1] != '~') \
|
||||
and (key.find("-chat") < 0) \
|
||||
and (key.find("latest_") < 0):
|
||||
path_to_file = os.path.join(
|
||||
os.path.expanduser(PPP_PATH_TO_USER_PEERS), key)
|
||||
new_dict[key] = pppdConfigParser(path_to_file)
|
||||
# print "Added and parsed <%s> (global)" % path_to_file
|
||||
except: ## maybe we have no permissions for os.listdir
|
||||
None # nothing we can do about it -
|
||||
# ToDo: maybe throw a message box
|
||||
|
||||
## read in system wide peers
|
||||
if os.path.exists(PPP_PATH_TO_GLOBAL_PEERS):
|
||||
try:
|
||||
for key in os.listdir(PPP_PATH_TO_GLOBAL_PEERS):
|
||||
if ((key[-1] != '~') \
|
||||
and (key.find("-chat") < 0) \
|
||||
and (key.find("latest_") < 0) \
|
||||
and (key.find(PPP_PATH_TO_USER_PEERS) < 0)):
|
||||
|
||||
path_to_file = os.path.join(
|
||||
PPP_PATH_TO_GLOBAL_PEERS, key)
|
||||
|
||||
new_dict[key] = pppdConfigParser(path_to_file)
|
||||
except: ## maybe we have no permissions for os.listdir
|
||||
print "could no access %s" % PPP_PATH_TO_GLOBAL_PEERS
|
||||
|
||||
print "found %d peers" % len(new_dict)
|
||||
|
||||
|
||||
## no peer found, creating default peer
|
||||
if len(new_dict) <= 0:
|
||||
## ToDo use users directory
|
||||
print "Will create a default peer in /etc/ppp/peers"
|
||||
if not os.path.exists(PPP_PATH_TO_GLOBAL_PEERS):
|
||||
try:
|
||||
os.makedirs(PPP_PATH_TO_GLOBAL_PEERS)
|
||||
except:
|
||||
print "Could not make %s dir" % PPP_PATH_TO_GLOBAL_PEERS
|
||||
try:
|
||||
filename = os.path.join(PPP_PATH_TO_GLOBAL_PEERS,
|
||||
PPP_DEFAULT_CONFIG_NAME)
|
||||
peer_fd = open(filename, 'w')
|
||||
print "Creating default peer in %s " % filename
|
||||
for line in PPP_DEFAULT_CONFIG.split('\n'):
|
||||
peer_fd.write("%s\n" %line)
|
||||
peer_fd.close()
|
||||
|
||||
## connect chat script
|
||||
filename = os.path.join(PPP_PATH_TO_GLOBAL_PEERS,
|
||||
"%s-connect-chat" % PPP_DEFAULT_CONFIG_NAME)
|
||||
print "Creating default chat file in %s " % filename
|
||||
peer_fd = open(filename, 'w')
|
||||
for line in PPP_DEFAULT_CONNECT_SCRIPT.split('\n'):
|
||||
peer_fd.write("%s\n" %line)
|
||||
peer_fd.close()
|
||||
|
||||
## disconnect chat script
|
||||
filename = os.path.join(PPP_PATH_TO_GLOBAL_PEERS,
|
||||
"%s-disconnect-chat" % PPP_DEFAULT_CONFIG_NAME)
|
||||
print "Creating default chat file in %s " % filename
|
||||
peer_fd = open(filename, 'w')
|
||||
for line in PPP_DEFAULT_DISCONNECT_SCRIPT.split('\n'):
|
||||
peer_fd.write("%s\n" %line)
|
||||
peer_fd.close()
|
||||
|
||||
filename = os.path.join(PPP_PATH_TO_GLOBAL_PEERS,
|
||||
PPP_DEFAULT_CONFIG_NAME)
|
||||
new_dict[PPP_DEFAULT_CONFIG_NAME] = pppdConfigParser(filename)
|
||||
except:
|
||||
print "Could not create peer <%s>" % os.path.join(
|
||||
PPP_PATH_TO_GLOBAL_PEERS, PPP_DEFAULT_CONFIG_NAME)
|
||||
return new_dict
|
||||
|
||||
################################################################################
|
||||
############# interfacing the pppd subprocess, regestering callbacks ###########
|
||||
################################################################################
|
||||
|
||||
## starting subprocess
|
||||
## ToDo: use -b and parse a logfile
|
||||
## to keep it running when SettingsGUI is quit
|
||||
## => find out if pppd is running on start up
|
||||
def start_pppd(self, config_file):
|
||||
parameters = "debug call %s" % config_file
|
||||
pppd = ProcessInterface(
|
||||
"start-stop-daemon --start -x %s -- %s" % (PPP_INIT, parameters))
|
||||
pppd.register_event_handler("ERROR", self.connection_error)
|
||||
pppd.register_event_handler("", self.update_output)
|
||||
pppd.register_event_handler("local IP address", self.update_local_ip)
|
||||
pppd.register_event_handler("remote IP address", self.update_remote_ip)
|
||||
|
||||
## ToDo see start_pppd
|
||||
def stop_pppd(self):
|
||||
pppd = ProcessInterface("start-stop-daemon --stop -x %s" % (PPP_INIT))
|
||||
pppd.register_event_handler("", self.update_output)
|
||||
self.set_state("disconnected")
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
############## Callbacks from pppd subprocess output - as callbacks ############
|
||||
################################################################################
|
||||
## called from pppd parser subprocess
|
||||
def update_local_ip(self, string):
|
||||
if len(string.split()) >= 3:
|
||||
self.local_ip = string.split()[3]
|
||||
else:
|
||||
self.local_ip = ""
|
||||
self.IP_text_buffer.set_text("Local IP: %s\nRemote IP: %s\nNameserver: %s" %(
|
||||
self.local_ip, self.remote_ip, self.nameserver_ip))
|
||||
|
||||
|
||||
## called from pppd parser subprocess
|
||||
def update_remote_ip(self, string):
|
||||
if len(string.split()) >= 3:
|
||||
self.remote_ip = string.split()[3]
|
||||
self.set_state("connected")
|
||||
else:
|
||||
self.remote_ip = ""
|
||||
self.IP_text_buffer.set_text("Local IP: %s\nRemote IP: %s\nNameserver: %s" %(
|
||||
self.local_ip, self.remote_ip, self.nameserver_ip))
|
||||
|
||||
|
||||
## called from pppd parser subprocess
|
||||
def connection_error(self, dummy):
|
||||
self.set_state("disconnected")
|
||||
|
||||
|
||||
## called indirectly from pppd parser subprocess (from set state)
|
||||
def update_nameserver(self):
|
||||
self.nameserver_ip = ""
|
||||
if self.state_string == "connected" and os.path.exists("/etc/resolv.conf"):
|
||||
fd = open("/etc/resolv.conf", 'r')
|
||||
for line in fd.readlines():
|
||||
if line.find("nameserver") >= 0:
|
||||
self.nameserver_ip = line.split()[1]
|
||||
break
|
||||
fd.close()
|
||||
|
||||
if not os.path.exists("/etc"):
|
||||
try:
|
||||
os.makedirs("/etc")
|
||||
except:
|
||||
print "could not make /etc directory"
|
||||
|
||||
if len(self.nameserver_ip) <= 0:
|
||||
try:
|
||||
fd = open("/etc/resolv.conf", 'w')
|
||||
fd.write("nameserver %s\n" % DEFAULT_NAMESERVER)
|
||||
except:
|
||||
print "could not edit /etc/resolv.conf to add a default Nameserver"
|
||||
|
||||
self.IP_text_buffer.set_text("Local IP: %s\nRemote IP: %s\nNameserver: %s" %(
|
||||
self.local_ip, self.remote_ip, self.nameserver_ip))
|
||||
|
||||
|
||||
## called on init and from pppd parser subprocess
|
||||
def set_state(self, state_string):
|
||||
self.state_string = state_string
|
||||
|
||||
if state_string == "connected":
|
||||
self.disconnect_btn.set_sensitive(1)
|
||||
self.connect_btn.set_sensitive(0)
|
||||
self.update_nameserver()
|
||||
|
||||
if state_string == "disconnected":
|
||||
self.connect_btn.set_sensitive(1)
|
||||
self.disconnect_btn.set_sensitive(0)
|
||||
self.update_local_ip("")
|
||||
self.update_remote_ip("")
|
||||
self.update_nameserver()
|
||||
|
||||
def update_output(self, string):
|
||||
## remove tailing and starting \n and \r - just in case
|
||||
string = string.rstrip('\n').lstrip('\n').rstrip('\r').lstrip('\r')
|
||||
print "pppd: <%s>" % string
|
||||
self.update_state(string)
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
############################## Callbacks from UI ###############################
|
||||
################################################################################
|
||||
|
||||
## called when drop down box selection changed
|
||||
def peer_changed_callback(self, widget):
|
||||
print "peers changed, filling in entries..."
|
||||
entry = widget.get_active_text()
|
||||
if not self.peer_entries.has_key(entry):
|
||||
self.update_state("Could not open a peer file")
|
||||
return False
|
||||
|
||||
self.current_peer_entry = self.peer_entries[entry]
|
||||
if self.peer_entries.has_key(entry):
|
||||
self.entry_dict["APN"].set_text(self.current_peer_entry.get_APN())
|
||||
self.entry_dict["User"].set_text(self.current_peer_entry.get_user())
|
||||
self.entry_dict["Password"].set_text(self.current_peer_entry.get_password())
|
||||
self.entry_dict["Number"].set_text(self.current_peer_entry.get_number())
|
||||
self.current_peer_entry.config_name = entry
|
||||
return True
|
||||
## user edited the settings
|
||||
def settings_changed(self, widget):
|
||||
self.entry_dict[widget.get_name()].set_text(widget.get_text())
|
||||
self.add_peer_btn.set_sensitive(1)
|
||||
|
||||
## ToDo
|
||||
def save_peer(self, widget):
|
||||
file_path = os.path.join(os.path.expanduser(PPP_PATH_TO_USER_PEERS), \
|
||||
self.current_peer_entry.config_name)
|
||||
if not os.path.exists("%s-backup" % file_path):
|
||||
print "will backup peer %s - %s" % (file_path, self.current_peer_entry.config_name)
|
||||
try:
|
||||
shutil.copyfile(file_path, "%s-backup" % file_path)
|
||||
|
||||
if os.path.exists("%s-connect-chat" % file_path) and \
|
||||
not os.path.exists("%s-connect-chat-backup" % file_path):
|
||||
shutil.copyfile("%s-connect-chat" % file_path, \
|
||||
"%s-connect-chat-backup" % file_path)
|
||||
|
||||
if os.path.exists("%s-disconnect-chat" % file_path) and \
|
||||
not os.path.exists("%s-disconnect-chat-backup" % file_path):
|
||||
shutil.copyfile("%s-disconnect-chat" % file_path, \
|
||||
"%s-disconnect-chat-backup" % file_path)
|
||||
except:
|
||||
self.update_state("Backup of old entry failed - aborting!")
|
||||
return False
|
||||
|
||||
|
||||
if self.current_peer_entry.generate_configuration(
|
||||
os.path.expanduser(PPP_PATH_TO_USER_PEERS), \
|
||||
self.current_peer_entry.config_name, \
|
||||
self.entry_dict["APN"].get_text(), \
|
||||
self.entry_dict["User"].get_text(), \
|
||||
self.entry_dict["Password"].get_text(), \
|
||||
self.entry_dict["Number"].get_text()):
|
||||
self.update_state("%s saved to %s" % (\
|
||||
self.current_peer_entry.config_name, \
|
||||
os.path.expanduser(PPP_PATH_TO_USER_PEERS)))
|
||||
|
||||
return True
|
||||
|
||||
def connect_clicked(self, widget):
|
||||
if self.GSM_Panel.stop_gsmd_btn.get_property("sensitive"):
|
||||
mbox = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO,
|
||||
gtk.BUTTONS_YES_NO, "Do you want to terminate gsmd first?")
|
||||
response = mbox.run()
|
||||
mbox.hide()
|
||||
mbox.destroy()
|
||||
if response == gtk.RESPONSE_YES:
|
||||
print "will terminate gsmd"
|
||||
self.GSM_Panel.stop_gsmd(None)
|
||||
|
||||
if self.current_peer_entry.generate_configuration(
|
||||
os.path.expanduser(PPP_PATH_TO_USER_PEERS), PPP_GENCONFIG_NAME, \
|
||||
self.entry_dict["APN"].get_text(), \
|
||||
self.entry_dict["User"].get_text(), \
|
||||
self.entry_dict["Password"].get_text(), \
|
||||
self.entry_dict["Number"].get_text()):
|
||||
self.start_pppd(PPP_GENCONFIG_NAME)
|
||||
|
||||
def disconnect_clicked(self, widget):
|
||||
self.stop_pppd()
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
############################## UI Helper fkts ##################################
|
||||
################################################################################
|
||||
|
||||
## change output on "state bar"
|
||||
def update_state(self, string):
|
||||
self.state_entry.set_text(string)
|
||||
|
||||
|
||||
## creating a label + entry box
|
||||
def add_entry_with_name(self, name, default_text, password_mode, callback):
|
||||
entry_box = gtk.HBox()
|
||||
|
||||
label = gtk.Label(name)
|
||||
label.set_width_chars(8)
|
||||
entry_box.set_spacing(15)
|
||||
entry_box.pack_start(label, False, False, 0)
|
||||
|
||||
entry = gtk.Entry()
|
||||
entry.set_text(default_text)
|
||||
entry.set_visibility(password_mode)
|
||||
entry.connect("changed", callback)
|
||||
entry.set_name(name)
|
||||
entry_box.add(entry)
|
||||
|
||||
self.entry_dict[name] = entry ## to access the text entry
|
||||
|
||||
entry_box.show()
|
||||
return entry_box
|
||||
|
||||
################################################################################
|
||||
################################# create UI ####################################
|
||||
################################################################################
|
||||
def create_notebook_page(self):
|
||||
# start_time = time.time()
|
||||
self.set_border_width(0)
|
||||
|
||||
peer_box = gtk.HBox()
|
||||
# self.peer_combo = gtk.combo_box_new_text()
|
||||
self.peer_combo = gtk.combo_box_entry_new_text()
|
||||
if len(self.peer_entries) <= 0:
|
||||
self.peer_combo.append_text("ERROR /etc/ppp/ access?") ## <- there was no peer and access to /etc/ppp was not possible
|
||||
for entry in self.peer_entries:
|
||||
self.peer_combo.append_text(entry)
|
||||
|
||||
self.peer_combo.set_focus_on_click(False)
|
||||
# self.peer_combo.set_property("allow_empty", 0)
|
||||
self.peer_combo.set_active(0)
|
||||
|
||||
# self.peer_combo.set_sensitive(0)
|
||||
self.peer_combo.connect('changed', self.peer_changed_callback)
|
||||
|
||||
self.add_peer_btn = gtk.Button()
|
||||
image = gtk.Image()
|
||||
image.set_from_icon_name("gtk-save", gtk.ICON_SIZE_MENU)
|
||||
self.add_peer_btn.add(image)
|
||||
self.add_peer_btn.connect('clicked', self.save_peer)
|
||||
peer_box.pack_start(self.add_peer_btn, False, False, 0)
|
||||
peer_box.add (self.peer_combo)
|
||||
if len(self.peer_entries) <= 0:
|
||||
self.add_peer_btn.set_sensitive(1)
|
||||
else:
|
||||
self.add_peer_btn.set_sensitive(0)
|
||||
|
||||
self.pack_start(peer_box, False, False, 0)
|
||||
|
||||
|
||||
# GPRS Settings
|
||||
gprs_frame = gtk.Frame("GPRS Login Settings")
|
||||
gprs_box = gtk.VBox()
|
||||
gprs_box.set_border_width(10)
|
||||
|
||||
gprs_box.add(self.add_entry_with_name("APN", "internet.eplus.de", True, self.settings_changed))
|
||||
gprs_box.add(self.add_entry_with_name("User", "gprs", True, self.settings_changed))
|
||||
gprs_box.add(self.add_entry_with_name("Password", "gprs", False, self.settings_changed))
|
||||
gprs_box.add(self.add_entry_with_name("Number", "*99***1#", True, self.settings_changed))
|
||||
gprs_frame.add(gprs_box)
|
||||
self.pack_start(gprs_frame, False, False, 0)
|
||||
|
||||
# buttons
|
||||
btn_box = gtk.HBox()
|
||||
|
||||
self.connect_btn = gtk.Button("Connect\nto GPRS")
|
||||
self.connect_btn.connect("clicked", self.connect_clicked)
|
||||
btn_box.add(self.connect_btn)
|
||||
## to prevent keyboard from beeing activated on startup
|
||||
self.set_focus_child(self.connect_btn)
|
||||
|
||||
self.disconnect_btn = gtk.Button("Disconnect\nfrom GPRS")
|
||||
self.disconnect_btn.connect("clicked", self.disconnect_clicked)
|
||||
self.disconnect_btn.set_sensitive(0)
|
||||
btn_box.add(self.disconnect_btn)
|
||||
|
||||
self.pack_start(btn_box, False, False, 0)
|
||||
|
||||
state_frame = gtk.Frame("GPRS State")
|
||||
|
||||
# IP infos
|
||||
state_box = gtk.VBox()
|
||||
|
||||
self.IP_box = gtk.VBox()
|
||||
self.IP_box.set_border_width(10)
|
||||
self.IP_text_view = gtk.TextView()
|
||||
self.IP_text_buffer = self.IP_text_view.get_buffer()
|
||||
self.IP_text_buffer.set_text("Local IP: %s\nRemote IP: %s\nNameserver: %s" %(
|
||||
self.local_ip, self.remote_ip, self.nameserver_ip))
|
||||
self.IP_text_view.set_editable(0)
|
||||
self.IP_box.add(self.IP_text_view)
|
||||
state_box.add(self.IP_box)
|
||||
|
||||
self.state_entry = gtk.Entry()
|
||||
self.state_entry.set_text("")
|
||||
self.state_entry.set_sensitive(0)
|
||||
state_box.add(self.state_entry)
|
||||
state_frame.add(state_box)
|
||||
self.pack_start(state_frame, False, False, 0)
|
||||
|
||||
## override the focus chain as OM will fire the keyboard
|
||||
## if a textentry is active
|
||||
focusable_widgets = [self.connect_btn,
|
||||
gprs_box] + [self.entry_dict[x] for x in self.entry_dict] + [self.peer_combo]
|
||||
|
||||
self.show_all()
|
||||
# print "time needed to init GPRS Panel = %s" % (time.time() - start_time)
|
452
SettingsGUI/trunk/src/settingsgui/GSMPanel.py
Normal file
|
@ -0,0 +1,452 @@
|
|||
"""
|
||||
* GSMPanel.py - SettingsGUI - GSM Settings
|
||||
*
|
||||
* Using libgsm_tool until there is a python bindung available
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import gtk
|
||||
# import gobject
|
||||
|
||||
from ProcessInterface import *
|
||||
from SysFSAccess import *
|
||||
from GlobalConfiguration import *
|
||||
#from settingsgui.ProcessInterface import *
|
||||
#from settingsgui.SysFSAccess import *
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
|
||||
|
||||
MAX_SIGNAL = 30.0
|
||||
LIBGSM_TOOL = "/usr/bin/libgsmd-tool"
|
||||
PATH_TO_LIBGSM_TOOL = "/usr/bin/"
|
||||
GSMD_INIT = "/etc/init.d/gsmd"
|
||||
SYSFS_ENTRY_GSM_POWER = "/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
|
||||
|
||||
class GSMPanel(gtk.VBox):
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self, False, 0)
|
||||
self.create_notebook_page()
|
||||
gtk.gdk.threads_init()
|
||||
self.gsm_state = 0
|
||||
self.start_gsm_tool()
|
||||
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
self.gsm_tool_at.write_to_process("\d") ## EOF!
|
||||
except:
|
||||
print "GSMPanel: Warning: gsmtool seems to be closed already"
|
||||
time.sleep(0.3)
|
||||
|
||||
|
||||
def start_gsm_tool(self):
|
||||
if os.path.exists(LIBGSM_TOOL):
|
||||
self.gsm_tool_at = ProcessInterface(
|
||||
"%s -m atcmd" % LIBGSM_TOOL)
|
||||
time.sleep(0.2)
|
||||
error_out = self.gsm_tool_at.read_error_from_process()
|
||||
if len(error_out) > 0:
|
||||
error_out = error_out.rstrip('\n').lstrip('\n').rstrip(
|
||||
'\r').lstrip('\r')
|
||||
self.update_state("error libgsm-tool: %s" % error_out)
|
||||
print "error libgsm-tool: %s" % error_out
|
||||
self.state_changed("Off")
|
||||
return False
|
||||
|
||||
self.gsm_tool_at.register_event_handler("RSTR=",\
|
||||
self.at_state_changed)
|
||||
time.sleep(0.3)
|
||||
|
||||
## request regestration state
|
||||
self.gsm_tool_at.write_to_process("AT+CREG?")
|
||||
|
||||
self.gsm_tool_at.register_event_handler("EVENT: Signal Quality",\
|
||||
self.link_quality_changed)
|
||||
self.gsm_tool_at.register_event_handler("EVENT: Netreg registered",\
|
||||
self.network_registration_changed)
|
||||
self.gsm_tool_at.register_event_handler("EVENT: Signal Quality",\
|
||||
self.link_quality_changed)
|
||||
self.gsm_tool_at.register_event_handler("# Power-On",\
|
||||
self.state_changed)
|
||||
self.gsm_tool_at.register_event_handler("# Register",\
|
||||
self.state_changed)
|
||||
self.gsm_tool_at.register_event_handler("", self.update_output)
|
||||
self.gsm_tool_at.register_event_handler("Our current operator is",\
|
||||
self.operator_changed)
|
||||
self.gsm_tool_at.register_event_handler("ERROR reading from gsm_fd",\
|
||||
self.gsm_fs_changed)
|
||||
self.state_changed("Init")
|
||||
|
||||
return True
|
||||
else:
|
||||
self.update_state("%s not found, most functions in the GSM panel disabled" % LIBGSM_TOOL)
|
||||
self.gsm_tool_at = False
|
||||
return False
|
||||
|
||||
|
||||
def check_pppd_running(self):
|
||||
if not os.path.exists("/proc"):
|
||||
return False
|
||||
for key in os.listdir("/proc"):
|
||||
if key.replace("/proc/", ""):
|
||||
if key.isdigit():
|
||||
fd = open(os.path.join("/proc/", key, "cmdline"))
|
||||
if fd.read().find("pppd") >= 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
################################################################################
|
||||
######### Callbacks from libgsmd-tool subprocess output - as callbacks #########
|
||||
################################################################################
|
||||
|
||||
def update_gsmd_state(self):
|
||||
None
|
||||
|
||||
def update_output(self, string):
|
||||
## remove tailing and starting \n and \r - just in case
|
||||
string = string.rstrip('\n').lstrip('\n').rstrip('\r').lstrip('\r')
|
||||
print "libgsmd-tool: <%s>" % string
|
||||
self.update_state(string)
|
||||
self.update_gsmd_state()
|
||||
|
||||
def gsm_fs_changed(self, string):
|
||||
self.state_changed("Off")
|
||||
|
||||
## called from gsmd at answer
|
||||
def at_state_changed(self, string):
|
||||
if string.find("RSTR=") < 0 or string.find(":") < 0\
|
||||
or string.find("`") < 0:
|
||||
if string.find("OK") >= 0:
|
||||
if self.gsm_state == 1:
|
||||
self.state_changed("Power-On")
|
||||
time.sleep(1)
|
||||
self.gsm_tool_at.write_to_process("AT+COPS?") ## request oper. name
|
||||
time.sleep(1)
|
||||
self.gsm_tool_at.write_to_process("AT+CSQ") ## request sign. qual.
|
||||
else:
|
||||
return False
|
||||
return True
|
||||
|
||||
response = string.split("`")[1].rstrip("'")
|
||||
cmd = response.split(":")[0]
|
||||
resp = response.split(":")[1].split(",")
|
||||
resp = [x.rstrip("\n").rstrip("'").rstrip("\"").lstrip("\"") for x in resp]
|
||||
|
||||
print "got a response from modem: CMD: %s Response: %s" %(cmd, resp)
|
||||
|
||||
## set location area code and cellid
|
||||
if string.find("+CREG") >= 0:
|
||||
if len(resp) == 3:
|
||||
location_area = resp[1]
|
||||
cell_id = resp[2]
|
||||
if len(resp) >= 4:
|
||||
location_area = resp[2]
|
||||
cell_id = resp[3]
|
||||
if len(resp) >= 3:
|
||||
self.reg_state_cbtn.set_active(1)
|
||||
self.connected_state_cbtn.set_active(1)
|
||||
self.state_changed("Connected")
|
||||
else:
|
||||
location_area = ""
|
||||
cell_id = ""
|
||||
self.state_changed("Init")
|
||||
|
||||
print "Got a location: %s/%s" % (location_area, cell_id)
|
||||
self.area_code_lbl.set_text("Location Area Code: %s" % location_area)
|
||||
self.cell_id_lbl.set_text("Cell ID: %s" % cell_id)
|
||||
if len(resp) >= 2: # it should always be
|
||||
if resp[0] == 0:
|
||||
self.reg_state_cbtn.set_active(0)
|
||||
self.connected_state_cbtn.set_active(0)
|
||||
if resp[1] == 0 or resp[1] == 2 or resp[1] == 3:
|
||||
self.connected_state_cbtn.set_active(0)
|
||||
if resp[1] == 5 or resp[1] == 1:
|
||||
self.reg_state_cbtn.set_active(1)
|
||||
self.connected_state_cbtn.set_active(1)
|
||||
|
||||
|
||||
if string.find("+COPS") >= 0:
|
||||
if len(resp) >= 3:
|
||||
self.operator_lbl.set_text("Operator: %s" % resp[2])
|
||||
"""
|
||||
else:
|
||||
if len(resp) == 1:
|
||||
time.sleep(3)
|
||||
## request oper. name
|
||||
self.gsm_tool_at.write_to_process("AT+COPS?")
|
||||
time.sleep(1)
|
||||
## request sign. qual.
|
||||
self.gsm_tool_at.write_to_process("AT+CSQ")
|
||||
"""
|
||||
|
||||
|
||||
if string.find("+CSQ") >= 0:
|
||||
if len(resp) >= 2:
|
||||
self.link_quality_changed("%s %s %s %s" % \
|
||||
(resp[0], resp[0], resp[0], resp[0], ))
|
||||
|
||||
|
||||
## set opername - ToDo
|
||||
|
||||
## called from gsmd event
|
||||
def link_quality_changed(self, line):
|
||||
## ToDo - strange - maybe filter the '#'???
|
||||
try:
|
||||
quality = int(line.split(" ")[4])
|
||||
except:
|
||||
quality = int(line.split(" ")[3])
|
||||
if quality != 99:
|
||||
self.scale_adj.value = int((quality / MAX_SIGNAL) * 100)
|
||||
self.sig_stength_scale.set_text("%3.4s %%" % ((quality / MAX_SIGNAL) * 100))
|
||||
|
||||
## called from gsmd event
|
||||
## ToDo - remove strange string-list-join-thing
|
||||
def operator_changed(self, line):
|
||||
line_list = line.split(" ")
|
||||
operator = " ".join([line_list[x+4] for x in range(len(line_list)-4)])
|
||||
self.operator_lbl.set_text("Operator: %s" % operator.rstrip('\n'))
|
||||
|
||||
## called from gsmd event
|
||||
## requesting name of operator
|
||||
def network_registration_changed(self, line):
|
||||
if len(line.split()) >= 11:
|
||||
location_area = line.split()[7]
|
||||
cell_id = line.split()[10]
|
||||
else:
|
||||
location_area = ""
|
||||
cell_id = ""
|
||||
|
||||
self.area_code_lbl.set_text("Location Area Code: %s"%location_area)
|
||||
self.cell_id_lbl.set_text("Cell ID: %s" % cell_id)
|
||||
if cell_id != "?":
|
||||
print "setting connected - cell_id=%s" % cell_id
|
||||
self.state_changed("Connected")
|
||||
self.operator_lbl.set_text("Operator: ")
|
||||
|
||||
|
||||
## called from gsmd event
|
||||
def state_changed(self, line):
|
||||
self.gsm_state = 0
|
||||
if line.find("Init") >= 0:
|
||||
self.gsm_state = 1
|
||||
if line.find("Power-On") >= 0:
|
||||
self.gsm_state = 2
|
||||
if line.find("Register") >= 0:
|
||||
self.gsm_state = 3
|
||||
if line.find("Connected") >= 0:
|
||||
self.gsm_tool_at.write_to_process("AT+COPS?") ## request oper. name
|
||||
time.sleep(1)
|
||||
self.gsm_tool_at.write_to_process("AT+CSQ") ## request sign. qual.
|
||||
self.gsm_state = 4
|
||||
|
||||
## may flicker
|
||||
self.lib_state_cbtn.set_active(0)
|
||||
|
||||
self.power_state_cbtn.set_active(0)
|
||||
self.power_state_cbtn.set_sensitive(0)
|
||||
self.power_state_cbtn.set_inconsistent(0)
|
||||
|
||||
self.reg_state_cbtn.set_active(0)
|
||||
self.reg_state_cbtn.set_sensitive(0)
|
||||
self.reg_state_cbtn.set_inconsistent(0)
|
||||
|
||||
self.connected_state_cbtn.set_active(0)
|
||||
|
||||
self.sig_stength_scale.set_text("Invalid")
|
||||
|
||||
## nothing
|
||||
if self.gsm_state == 0:
|
||||
self.start_gsmd_btn.set_sensitive(1)
|
||||
self.start_gsmd_btn.set_sensitive(1)
|
||||
self.stop_gsmd_btn.set_sensitive(0)
|
||||
|
||||
## init lib
|
||||
if self.gsm_state > 0:
|
||||
self.lib_state_cbtn.set_active(1)
|
||||
self.power_state_cbtn.set_sensitive(1)
|
||||
self.start_gsmd_btn.set_sensitive(0)
|
||||
self.stop_gsmd_btn.set_sensitive(1)
|
||||
|
||||
## power
|
||||
if self.gsm_state > 1:
|
||||
self.power_state_cbtn.set_active(1)
|
||||
self.reg_state_cbtn.set_sensitive(1)
|
||||
|
||||
## register
|
||||
if self.gsm_state > 2:
|
||||
self.reg_state_cbtn.set_active(1)
|
||||
|
||||
## connected
|
||||
if self.gsm_state > 3:
|
||||
self.connected_state_cbtn.set_active(1)
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
############################## Callbacks from UI ###############################
|
||||
################################################################################
|
||||
|
||||
def power_cb_changed(self, widget):
|
||||
widget.set_inconsistent(1)
|
||||
if widget.get_active():
|
||||
## power on modem
|
||||
print "sending power-on request to modem"
|
||||
self.gsm_tool_at.write_to_process("AT+CFUN=1")
|
||||
|
||||
def register_cb_changed(self, widget):
|
||||
widget.set_inconsistent(1)
|
||||
if widget.get_active():
|
||||
print "sending register request to modem"
|
||||
self.gsm_tool_at.write_to_process("AT+COPS=0")
|
||||
|
||||
def stop_gsmd(self, widget):
|
||||
os.popen("start-stop-daemon --stop -x /usr/sbin/gsmd")
|
||||
time.sleep(2) ## libgsmd-tool will flush some outdated data
|
||||
self.start_gsmd_btn.set_sensitive(1)
|
||||
self.stop_gsmd_btn.set_sensitive(0)
|
||||
self.state_changed("Off")
|
||||
|
||||
|
||||
def start_gsmd(self, widget):
|
||||
# restart not working yet - using stop and start
|
||||
if self.check_pppd_running():
|
||||
mbox = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_YES_NO,
|
||||
"There seems to be a GPRS connection runnung.\nDo you want to close it?")
|
||||
response = mbox.run()
|
||||
mbox.hide()
|
||||
mbox.destroy()
|
||||
if response == gtk.RESPONSE_YES:
|
||||
print "will terminate pppd"
|
||||
os.system("start-stop-daemon --stop -x %s" % (PPP_INIT))
|
||||
|
||||
os.system("%s stop" %(GSMD_INIT))
|
||||
print "executing: %s start" %(GSMD_INIT)
|
||||
os.system("%s start" %(GSMD_INIT))
|
||||
time.sleep(0.5)
|
||||
self.link_quality_changed("0 0 0 0 0")
|
||||
self.network_registration_changed("? ? ? ? ? ? ? ? ? ? ?")
|
||||
self.start_gsmd_btn.set_sensitive(0)
|
||||
self.stop_gsmd_btn.set_sensitive(1)
|
||||
time.sleep(1) ## give the gsmd some time to init... :-/
|
||||
self.reinit_libgsmd_tool(None)
|
||||
|
||||
def reinit_libgsmd_tool(self, widget):
|
||||
if not self.start_gsm_tool():
|
||||
print "error starting gsm-tool - abort reinit"
|
||||
return
|
||||
self.link_quality_changed("0 0 0 0 0")
|
||||
self.network_registration_changed("? ? ? ? ? ? ? ? ? ? ?")
|
||||
self.state_changed("Init")
|
||||
self.operator_changed("? ? ? ? ?")
|
||||
|
||||
def get_cur_sig_strength(self):
|
||||
# ToDo - parse everything!
|
||||
return 0 #ToDo
|
||||
|
||||
|
||||
## change output on "state bar"
|
||||
def update_state(self, string):
|
||||
self.state_entry.set_text(string)
|
||||
|
||||
|
||||
def create_notebook_page(self):
|
||||
self.set_border_width(0)
|
||||
|
||||
top_btn_box = gtk.HBox(False, 0)
|
||||
self.start_gsmd_btn = gtk.Button("Start\ngsmd")
|
||||
self.start_gsmd_btn.connect("clicked", self.start_gsmd)
|
||||
top_btn_box.add(self.start_gsmd_btn)
|
||||
|
||||
self.stop_gsmd_btn = gtk.Button("Stop\ngsmd")
|
||||
self.stop_gsmd_btn.connect("clicked", self.stop_gsmd)
|
||||
top_btn_box.add(self.stop_gsmd_btn)
|
||||
|
||||
self.pack_start(top_btn_box, False, False, 0)
|
||||
|
||||
# signal Quality
|
||||
frame = gtk.Frame("Signal Stength")
|
||||
box = gtk.VBox()
|
||||
box.set_border_width(15)
|
||||
|
||||
self.scale_adj = gtk.Adjustment(self.get_cur_sig_strength(), 0.0,
|
||||
100, 1.0, 1.0, 0.0)
|
||||
self.sig_stength_scale = gtk.ProgressBar(self.scale_adj)
|
||||
self.sig_stength_scale.set_text("0.0 %")
|
||||
box.add(self.sig_stength_scale)
|
||||
frame.add(box)
|
||||
self.pack_start(frame, False, False, 1)
|
||||
|
||||
# cell info
|
||||
cell_frame = gtk.Frame("Cell Information")
|
||||
cell_box = gtk.VBox()
|
||||
cell_box.set_border_width(15)
|
||||
|
||||
self.area_code_lbl = gtk.Label("Location Area Code: ?")
|
||||
cell_box.add(self.area_code_lbl)
|
||||
|
||||
self.cell_id_lbl = gtk.Label("Cell ID: ?")
|
||||
cell_box.add(self.cell_id_lbl)
|
||||
|
||||
self.operator_lbl = gtk.Label("Operator: ?")
|
||||
cell_box.add(self.operator_lbl)
|
||||
|
||||
cell_frame.add(cell_box)
|
||||
self.pack_start(cell_frame, False, False, 0)
|
||||
|
||||
# state
|
||||
state_frame = gtk.Frame("GSM State")
|
||||
state_box = gtk.HBox()
|
||||
state_box1 = gtk.VBox()
|
||||
state_box2 = gtk.VBox()
|
||||
state_box.set_border_width(15)
|
||||
|
||||
self.lib_state_cbtn = gtk.CheckButton("Init")
|
||||
self.lib_state_cbtn.set_sensitive(1)
|
||||
self.lib_state_cbtn.connect("released", self.reinit_libgsmd_tool)
|
||||
state_box1.add(self.lib_state_cbtn)
|
||||
self.power_state_cbtn = gtk.CheckButton("Power")
|
||||
self.power_state_cbtn.set_sensitive(1)
|
||||
self.power_state_cbtn.connect("released", self.power_cb_changed)
|
||||
state_box1.add(self.power_state_cbtn)
|
||||
self.reg_state_cbtn = gtk.CheckButton("Register")
|
||||
self.reg_state_cbtn.set_sensitive(1)
|
||||
self.reg_state_cbtn.connect("released", self.register_cb_changed)
|
||||
state_box2.add(self.reg_state_cbtn)
|
||||
self.connected_state_cbtn = gtk.CheckButton("Connected")
|
||||
self.connected_state_cbtn.set_sensitive(0)
|
||||
state_box2.add(self.connected_state_cbtn)
|
||||
|
||||
state_box.add(state_box1)
|
||||
state_box.add(state_box2)
|
||||
state_frame.add(state_box)
|
||||
self.pack_start(state_frame, False, False, 0)
|
||||
|
||||
|
||||
state_bar_box = gtk.VBox()
|
||||
self.state_entry = gtk.Entry()
|
||||
self.state_entry.set_text("")
|
||||
self.state_entry.set_sensitive(0)
|
||||
state_bar_box.add(self.state_entry)
|
||||
self.pack_start(state_bar_box, False, False, 0)
|
||||
|
||||
self.show_all()
|
128
SettingsGUI/trunk/src/settingsgui/GlobalConfiguration.py
Normal file
|
@ -0,0 +1,128 @@
|
|||
"""
|
||||
* GlobalConfiguration.py - SettingsGUI -
|
||||
* Settings and default config files
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
NOTEBK_PADDING = 6
|
||||
GSM_Panel_Instance = None
|
||||
|
||||
## used in Screen Panel
|
||||
SYSFS_ENTRY_BACKLIGHT_BRIGHTNESS = "/sys/class/backlight/gta01-bl/brightness"
|
||||
SYSFS_ENTRY_BACKLIGHT_POWER = "/sys/class/backlight/gta01-bl/power" # reverse
|
||||
|
||||
## used in Bluetooth Panel
|
||||
SYSFS_ENTRY_BLUETOOTH_POWER = "/sys/bus/platform/devices/gta01-pm-bt.0/power_on"
|
||||
HCICONFIG_CMD = "hciconfig" ## using $PATH
|
||||
#HCICONFIG_CMD = "/sbin/hciconfig" ## openembedded
|
||||
#HCICONFIG_CMD = "/usr/sbin/hciconfig" ## ubuntu
|
||||
HCITOOL_CMD = "hcitool" ## using $PATH
|
||||
BLUETOOTH_DEVICE = "hci0"
|
||||
|
||||
## used in Audio Panel
|
||||
ALSA_STATES_DIR = "/etc/"
|
||||
|
||||
ALSA_ENTRYS = {
|
||||
"GSM Handset" : "gsmhandset.state",
|
||||
"GSM Headset" : "gsmheadset.state",
|
||||
"Capture Handset" : "capturehandset.state",
|
||||
"Capture Headset" : "captureheadset.state",
|
||||
"GSM Bluetooth" : "gsmbluetooth.state",
|
||||
"Stereoout" : "stereoout.state"
|
||||
}
|
||||
|
||||
ALSA_AMIXER = "/usr/bin/amixer"
|
||||
## amixer cset numid=87 30
|
||||
|
||||
ALSA_CHANNEL_LEFT = 86
|
||||
ALSA_CHANNEL_RIGHT = 87
|
||||
ALSA_CHANNEL_MONO = 88
|
||||
|
||||
|
||||
## PPP Settings and config files
|
||||
|
||||
DEFAULT_NAMESERVER = "208.67.222.222" # from the OpenDNS project (2007-09-05)
|
||||
|
||||
PPP_PATH_TO_PPP = "/etc/ppp/"
|
||||
PPP_PATH_TO_GLOBAL_PEERS = "/etc/ppp/peers/"
|
||||
## ToDo move to ~/.settings-gui/ppp/
|
||||
## => ToDo find out how to tell pppd...
|
||||
PPP_PATH_TO_USER_PEERS = "/etc/ppp/peers/"
|
||||
PPP_GENCONFIG_NAME = "latest_gprs"
|
||||
PPP_DEFAULT_CONFIG_NAME = "gprs"
|
||||
PPP_INIT = "/usr/sbin/pppd"
|
||||
|
||||
PPP_SECRETS_FILES = ["/etc/ppp/pap-secrets", "/etc/ppp/chap-secrets"]
|
||||
|
||||
## from http://wiki.openmoko.org/wiki/Manually_using_GPRS
|
||||
## thanks Pavel!
|
||||
PPP_DEFAULT_CONNECT_SCRIPT = """exec chat
|
||||
TIMEOUT 22
|
||||
ECHO ON
|
||||
ABORT '\\nBUSY\\r'
|
||||
ABORT '\\nERROR\\r'
|
||||
ABORT '\\nNO ANSWER\\r'
|
||||
ABORT '\\nNO CARRIER\\r'
|
||||
ABORT '\\nNO DIALTONE\\r'
|
||||
ABORT '\\nRINGING\\r\\n\\r\\nRINGING\\r'
|
||||
SAY "\\nDefining Packet Data Protocol context...\\n"
|
||||
"" "\\d"
|
||||
"" "atz"
|
||||
OK "ate1"
|
||||
OK 'at+cgdcont=1,"ip","internet.eplus.de","0.0.0.0",0,0'
|
||||
TIMEOUT 22
|
||||
OK ATD*99#
|
||||
TIMEOUT 33
|
||||
SAY "\\nWaiting for connect...\\n"
|
||||
CONNECT ""
|
||||
SAY "\\nConnected." """
|
||||
|
||||
|
||||
PPP_DEFAULT_DISCONNECT_SCRIPT = """exec /usr/sbin/chat -V -s -S
|
||||
ABORT "BUSY"
|
||||
ABORT "ERROR"
|
||||
ABORT "NO DIALTONE"
|
||||
SAY "\nSending break to the modem\n"
|
||||
"" "\K"
|
||||
"" "\K"
|
||||
"" "\K"
|
||||
"" "+++ATH"
|
||||
"" "+++ATH"
|
||||
"" "+++ATH"
|
||||
"NO CARRIER" ""
|
||||
SAY "\nPDP context detached\n" """
|
||||
|
||||
## deafult ppp peer - will be written to /etc/ppp/peers
|
||||
## if no other peer is found
|
||||
PPP_DEFAULT_CONFIG = """/dev/ttySAC0
|
||||
novjccomp
|
||||
crtscts
|
||||
nodetach
|
||||
defaultroute
|
||||
noipdefault
|
||||
disconnect /etc/ppp/peers/gprs-disconnect-chat
|
||||
novj
|
||||
holdoff 5
|
||||
ipcp-accept-local
|
||||
user eplus
|
||||
password gprs
|
||||
replacedefaultroute
|
||||
lcp-echo-failure 40000
|
||||
connect /etc/ppp/peers/gprs-connect-chat
|
||||
"""
|
266
SettingsGUI/trunk/src/settingsgui/ProcessInterface.py
Normal file
|
@ -0,0 +1,266 @@
|
|||
"""
|
||||
* ProcessInterface.py - SettingsGUI -
|
||||
* Interface to interactive userspace processes
|
||||
*
|
||||
* Based on code from Jens Diemer <- ToDo - License
|
||||
*
|
||||
* Using libgsm_tool until there is a python bindung available
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import threading
|
||||
import signal
|
||||
import time
|
||||
|
||||
class error_poller(threading.Thread):
|
||||
def __init__(self, error_stream):
|
||||
self.error_stream = error_stream
|
||||
threading.Thread.__init__(self)
|
||||
## init
|
||||
self.out_data = []
|
||||
self.keep_going = True
|
||||
self.start()
|
||||
|
||||
def run(self):
|
||||
while self.keep_going:
|
||||
self.error_stream.flush()
|
||||
line = self.error_stream.readline()
|
||||
if line == "": break
|
||||
self.out_data.append(line)
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
kills process if still running
|
||||
"""
|
||||
if self.process.poll() != None:
|
||||
print " already killed"
|
||||
return
|
||||
|
||||
self.killed = True
|
||||
os.kill(self.process.pid, signal.SIGQUIT)
|
||||
## gice it a second
|
||||
time.sleep(1)
|
||||
## have to kill - as readline is blocking.
|
||||
os.kill( self.process.pid, signal.SIGKILL )
|
||||
|
||||
|
||||
|
||||
class async_process(threading.Thread):
|
||||
"""
|
||||
asynchronous subprocess handler
|
||||
|
||||
used to read the output - access through out_data
|
||||
|
||||
not working with Windows - as there is no os.kill() available
|
||||
command - the command to be started
|
||||
cwd - directory for execution
|
||||
timeout - timeout for stop -
|
||||
0 to execution until self.keep_going is set to False
|
||||
"""
|
||||
def __init__(self, command, options, cwd, timeout):
|
||||
self.command = command
|
||||
self.options = options
|
||||
self.cwd = cwd
|
||||
self.timeout = timeout
|
||||
self.process_created_error = False
|
||||
self.process_created = False ## find out when subprocess() finished
|
||||
self.keep_going = True
|
||||
|
||||
self.killed = False
|
||||
self.out_data = [] # output buffer <- ToDo use a list - for now '\n's
|
||||
self.events = []
|
||||
|
||||
threading.Thread.__init__(self)
|
||||
|
||||
# print "COMMAND was >>%s<<" % self.command
|
||||
self.start()
|
||||
|
||||
"""
|
||||
if timeout > 0:
|
||||
self.join( self.timeout )
|
||||
else:
|
||||
self.keep_going = True
|
||||
while self.keep_going == True:
|
||||
time.sleep(1)
|
||||
|
||||
self.join()
|
||||
self.stop()
|
||||
|
||||
"""
|
||||
# provide return code
|
||||
#self.returncode = self.process.returncode
|
||||
|
||||
def run(self):
|
||||
print "Executes subprocess [%s]" % " ".join([self.command] + self.options)
|
||||
try:
|
||||
self.process = subprocess.Popen(
|
||||
[self.command] + self.options,
|
||||
cwd = self.cwd,
|
||||
bufsize = 1, # line buffer
|
||||
shell = False,
|
||||
# shell = True, # resulting in broken pipe on stdout
|
||||
universal_newlines = True, # changes any nl/cr-combination to one nl
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE,
|
||||
stdin = subprocess.PIPE
|
||||
)
|
||||
except:
|
||||
print "Error: subprocess %s could not be started" % self.command
|
||||
self.process = 0
|
||||
self.process_created_error = True
|
||||
|
||||
self.process_created = True
|
||||
# save output
|
||||
line = ""
|
||||
while self.keep_going:
|
||||
char = ""
|
||||
while char == "":
|
||||
char = self.process.stdout.read(1)
|
||||
if char == "":
|
||||
## nonblocking? okay let's take a nap
|
||||
time.sleep(0.5)
|
||||
|
||||
line = line + char
|
||||
if line[-1] == "\n":
|
||||
self.out_data.append(line)
|
||||
|
||||
for event in self.events:
|
||||
if line.find(event[0]) >= 0:
|
||||
event[1](line)
|
||||
line = ""
|
||||
|
||||
print "Subprocess terminated"
|
||||
|
||||
## event_name <- string to search for (e.g. EVENT: blah changed...)
|
||||
## function <- function to call
|
||||
def register_event_handler(self, event_name, function, args, kwargs):
|
||||
self.events.append([event_name, function, args, kwargs])
|
||||
|
||||
def stop( self ):
|
||||
"""
|
||||
kills process if still running
|
||||
"""
|
||||
if self.process.poll() != None:
|
||||
print " already killed"
|
||||
return
|
||||
|
||||
print "trying to kill"
|
||||
self.killed = True
|
||||
os.kill( self.process.pid, signal.SIGQUIT )
|
||||
## gice it a second
|
||||
time.sleep(1)
|
||||
## have to kill - as readline is blocking.
|
||||
os.kill( self.process.pid, signal.SIGKILL )
|
||||
|
||||
class ProcessInterface:
|
||||
def __init__(self, command):
|
||||
self.command = command.split()[0]
|
||||
self.options = [command.split()[x] for x in range(1,len(command.split()))]
|
||||
self.process = async_process(self.command, self.options, "/", timeout = 0)
|
||||
|
||||
while self.process.process_created == False:
|
||||
if self.process.process_created_error:
|
||||
return -1
|
||||
time.sleep(0.1)
|
||||
self.error_poller = error_poller(self.process.process.stderr)
|
||||
|
||||
## write string to buffer - new line is attached string
|
||||
def write_to_process(self, string):
|
||||
## find out if process is still running before wire
|
||||
if self.process.process.poll() == None: # was ==
|
||||
self.process.process.stdin.write("%s\n" % string)
|
||||
self.process.process.stdin.flush()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
## read back string with all output lines currently in buffer
|
||||
def read_from_process(self):
|
||||
out_string = ""
|
||||
for x in self.process.out_data:
|
||||
out_string += x
|
||||
return out_string
|
||||
|
||||
## read back string with all error lines currently in buffer
|
||||
def read_error_from_process(self):
|
||||
out_string = ""
|
||||
for x in self.error_poller.out_data:
|
||||
out_string += x
|
||||
return out_string
|
||||
|
||||
## removes first error in list
|
||||
def get_error(self):
|
||||
if len(self.error_poller.out_data) > 0:
|
||||
out_string = self.error_poller.out_data[0]
|
||||
self.error_poller.out_data.remove(out_string)
|
||||
out_string = out_string.split("\n")[0]
|
||||
return out_string
|
||||
else:
|
||||
return ""
|
||||
|
||||
## removes first output in list
|
||||
def get_output(self):
|
||||
if len(self.process.out_data) > 0:
|
||||
out_string = self.process.out_data[0]
|
||||
self.process.out_data.remove(out_string)
|
||||
out_string = out_string.split("\n")[0]
|
||||
return out_string
|
||||
else:
|
||||
return ""
|
||||
|
||||
def register_event_handler(self, event_name, function, args = [], kwargs = {}):
|
||||
self.process.register_event_handler(event_name, function, args, kwargs)
|
||||
|
||||
def close_process(self):
|
||||
print "trying to kill process"
|
||||
self.process.keep_going = False
|
||||
self.process.join(1)
|
||||
self.process.stop()
|
||||
self.process.join(1)
|
||||
|
||||
|
||||
class test:
|
||||
def do_test(self):
|
||||
print "Test interface"
|
||||
bash = ProcessInterface("/bin/sh")
|
||||
print "subprocess created"
|
||||
|
||||
time_running = 0
|
||||
while time_running < 5:
|
||||
print "\nEntering while loop"
|
||||
time_running = time_running + 1
|
||||
bash.write_to_process("echo hello")
|
||||
bash.write_to_process("echo error > /dev/stderr")
|
||||
time.sleep(0.2)
|
||||
print "next output<%s>" % bash.get_output()
|
||||
# print "===\nstdout: <%s> \n===" % bash.read_from_process()
|
||||
print "next error<%s>" % bash.get_error()
|
||||
# print "===\nstderr: <%s> \n===" % bash.read_error_from_process()
|
||||
# time.sleep(0.2)
|
||||
|
||||
bash.close_process()
|
||||
print "halllooo"
|
||||
|
||||
# ToDo remove
|
||||
## self.process = subprocess.Popen(self.command, cwd = self.cwd, shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE, stdin = subprocess.PIPE)
|
||||
|
||||
#test = test()
|
||||
#test.do_test()
|
122
SettingsGUI/trunk/src/settingsgui/ScreenPanel.py
Normal file
|
@ -0,0 +1,122 @@
|
|||
"""
|
||||
* ScreenPanel.py - SettingGUI - Screen Settings Section
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
import os
|
||||
import gtk
|
||||
from SysFSAccess import *
|
||||
from GlobalConfiguration import *
|
||||
#from settingsgui.SysFSAccess import *
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
|
||||
class ScreenPanel(gtk.VBox):
|
||||
orientation = 0
|
||||
|
||||
def __init__(self):
|
||||
gtk.VBox.__init__(self, False, 0)
|
||||
self.create_notebook_page()
|
||||
|
||||
def toggle_backlight(self, widget):
|
||||
print "trying to toggle the backlight"
|
||||
value = get_sysfs_value(SYSFS_ENTRY_BACKLIGHT_POWER)
|
||||
if value.find("1") != -1:
|
||||
set_sysfs_value(SYSFS_ENTRY_BACKLIGHT_POWER, 0)
|
||||
value = "1"
|
||||
else:
|
||||
set_sysfs_value(SYSFS_ENTRY_BACKLIGHT_POWER, 1)
|
||||
value = "0"
|
||||
|
||||
def toggle_orientation(self, widget):
|
||||
print "trying to toggle screen orientation"
|
||||
if self.orientation == 0:
|
||||
os.system("/usr/bin/xrandr -o 1")
|
||||
self.orientation = 1
|
||||
else:
|
||||
os.system("/usr/bin/xrandr -o 0")
|
||||
self.orientation = 0
|
||||
|
||||
|
||||
def restart_x_server(self, widget):
|
||||
mbox = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_YES_NO,
|
||||
"You hit the Restart-Phone-GUI-Button!\nThis will restart the X11-Server!\nDo you really want to quit ALL applications? (including SettingGUI)")
|
||||
response = mbox.run()
|
||||
mbox.hide()
|
||||
mbox.destroy()
|
||||
if response == gtk.RESPONSE_YES:
|
||||
print "SettingsGUI is restarting X11..."
|
||||
os.system("/etc/init.d/xserver-nodm restart")
|
||||
|
||||
|
||||
def bl_level_changed(self, widget):
|
||||
tmp_value = widget.value
|
||||
tmp_value = tmp_value * 50
|
||||
print "trying to set backlight to %s" % tmp_value
|
||||
set_sysfs_value(SYSFS_ENTRY_BACKLIGHT_BRIGHTNESS, tmp_value)
|
||||
|
||||
def create_notebook_page(self):
|
||||
self.set_border_width(0)
|
||||
|
||||
level_frame = gtk.Frame("Backlight Level")
|
||||
level_frame.set_border_width(0)
|
||||
level_box = gtk.VBox(False, 0)
|
||||
level_box.set_border_width(15)
|
||||
|
||||
init_value = get_sysfs_value(SYSFS_ENTRY_BACKLIGHT_BRIGHTNESS)
|
||||
if len(init_value) > 0:
|
||||
init_value = float(init_value) / 50
|
||||
else:
|
||||
init_value = 50
|
||||
|
||||
|
||||
## scale to set backlight level
|
||||
scale_adj = gtk.Adjustment(init_value, 0.0, 100.0, 1.0, 1.0, 0.0)
|
||||
scale_adj.connect("value_changed", self.bl_level_changed, )
|
||||
backlight_scale = gtk.HScale(scale_adj)
|
||||
backlight_scale.set_digits(0)
|
||||
level_box.add(backlight_scale)
|
||||
|
||||
level_frame.add(level_box)
|
||||
self.pack_start(level_frame, False, False, 0)
|
||||
|
||||
button_box = gtk.HBox(False, 0)
|
||||
button_box.set_border_width(0)
|
||||
self.add(button_box)
|
||||
|
||||
## button to restart xserver
|
||||
restart_x_btn = gtk.Button("Restart Phone GUI")
|
||||
restart_x_btn.connect("clicked", self.restart_x_server)
|
||||
# button_box.add(restart_x_btn)
|
||||
|
||||
## button to toggle backlight
|
||||
bl_toggle_btn = gtk.Button("Backlight\non/off")
|
||||
bl_toggle_btn.connect("clicked", self.toggle_backlight)
|
||||
button_box.add(bl_toggle_btn)
|
||||
|
||||
## button to change orientation
|
||||
orientation_toggle_btn = gtk.Button("Landscape/\nPortrait")
|
||||
orientation_toggle_btn.connect("clicked", self.toggle_orientation)
|
||||
button_box.add(orientation_toggle_btn)
|
||||
|
||||
self.show_all()
|
||||
## label to describe notebook page
|
||||
label = gtk.Label("Backlight")
|
||||
return (self, label)
|
153
SettingsGUI/trunk/src/settingsgui/SettingsGUI.py
Normal file
|
@ -0,0 +1,153 @@
|
|||
"""
|
||||
* SettingsGUI.py - Creating the main window
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
import time
|
||||
import sys
|
||||
import gtk
|
||||
import gobject
|
||||
import time
|
||||
import threading
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
from GlobalConfiguration import *
|
||||
|
||||
class ToggleInterface(threading.Thread):
|
||||
def __init__(self, settings_gui):
|
||||
self.settings_gui = settings_gui
|
||||
threading.Thread.__init__(self)
|
||||
## init
|
||||
print "INIT THREAD FOR UI"
|
||||
self.out_data = []
|
||||
self.keep_going = True
|
||||
self.start()
|
||||
|
||||
def run(self):
|
||||
print "STARTING UI"
|
||||
gtk.gdk.threads_init()
|
||||
gtk.gdk.threads_enter()
|
||||
# if :
|
||||
# self.settings_gui.create_UI()
|
||||
|
||||
class SettingsGUI:
|
||||
def delete_event(self, widget, event, data=None):
|
||||
gtk.main_quit()
|
||||
print("Waiting for all processes to quit...")
|
||||
time.sleep(1.5)
|
||||
sys.exit(0)
|
||||
return False
|
||||
|
||||
def add_notebook_page(self, panel, icon_name):
|
||||
image = gtk.Image()
|
||||
image.set_from_icon_name(icon_name, gtk.ICON_SIZE_LARGE_TOOLBAR)
|
||||
image.show()
|
||||
image_alignment = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1.0, yscale=1.0)
|
||||
image_alignment.add(image)
|
||||
image_alignment.set_padding(NOTEBK_PADDING, NOTEBK_PADDING, 0, 0)
|
||||
image_alignment.show()
|
||||
scroll_win = gtk.ScrolledWindow()
|
||||
scroll_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
scroll_win.show()
|
||||
scroll_win.add_with_viewport(panel)
|
||||
self.notebook.append_page(scroll_win, image_alignment)
|
||||
|
||||
# do this in an extra method - so init can return faster
|
||||
def create_UI(self):
|
||||
if self.state != "init-done":
|
||||
return
|
||||
|
||||
self.state = "running"
|
||||
self.window.remove(self.loading_lbl)
|
||||
start_time = self.start_time
|
||||
self.window.set_title("SettingsGUI")
|
||||
print "0.2: %s" %(time.time() - start_time)
|
||||
|
||||
## not working from shell - is within package
|
||||
#from settingsgui.ScreenPanel import ScreenPanel
|
||||
#from settingsgui.AudioPanel import AudioPanel
|
||||
#from settingsgui.GSMPanel import GSMPanel
|
||||
#from settingsgui.GPRSPanel import GPRSPanel
|
||||
#from settingsgui.BluetoothPanel import BluetoothPanel
|
||||
|
||||
from ScreenPanel import ScreenPanel
|
||||
from AudioPanel import AudioPanel
|
||||
from GSMPanel import GSMPanel
|
||||
from GPRSPanel import GPRSPanel
|
||||
from BluetoothPanel import BluetoothPanel
|
||||
|
||||
|
||||
print "0.3: %s" %(time.time() - start_time)
|
||||
|
||||
|
||||
self.notebook = gtk.Notebook()
|
||||
self.notebook.set_tab_pos(gtk.POS_BOTTOM)
|
||||
|
||||
|
||||
print "1: %s" %(time.time() - start_time)
|
||||
|
||||
self.add_notebook_page(ScreenPanel(), "preferences-desktop-screensaver")
|
||||
|
||||
print "2: %s" %(time.time() - start_time)
|
||||
|
||||
self.add_notebook_page(AudioPanel(), "moko-speaker")
|
||||
print "3: %s" %(time.time() - start_time)
|
||||
GSM_Panel = GSMPanel()
|
||||
self.add_notebook_page(GSM_Panel, "moko-call-redial")
|
||||
print "4: %s" %(time.time() - start_time)
|
||||
self.add_notebook_page(GPRSPanel(GSM_Panel), "gtk-network")
|
||||
print "5: %s" %(time.time() - start_time)
|
||||
self.add_notebook_page(BluetoothPanel(), "gtk-connect")
|
||||
print "6: %s" %(time.time() - start_time)
|
||||
|
||||
## expand page selectors to full width
|
||||
for child in self.notebook.get_children():
|
||||
self.notebook.child_set_property(child, "tab_expand", True)
|
||||
self.notebook.show()
|
||||
|
||||
print "7: %s" %(time.time() - start_time)
|
||||
|
||||
#self.main_panel.add(self.notebook)
|
||||
|
||||
txt = gtk.Label("Loading ...")
|
||||
self.window.add(self.notebook)
|
||||
|
||||
self.window.show_all()
|
||||
#self.window.queue_draw_area(0,0,-1,-1)
|
||||
self.window.show()
|
||||
|
||||
def __init__(self):
|
||||
self.state = "init"
|
||||
start_time = time.time()
|
||||
self.start_time = start_time
|
||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
self.window.set_border_width(0)
|
||||
self.window.set_default_size(480, 640)
|
||||
self.window.connect("delete_event", self.delete_event)
|
||||
self.notebook = gtk.Notebook()
|
||||
self.state = "init-done"
|
||||
# we can't let them wait!
|
||||
print "0.1: %s" %(time.time() - start_time)
|
||||
self.loading_lbl = gtk.Label("Loading ...")
|
||||
self.window.add(self.loading_lbl)
|
||||
self.window.show_all()
|
||||
# self.window.add(txt)
|
||||
#self.main_panel = gtk.VBox()
|
||||
#self.main_panel.add(self.notebook)
|
||||
# self.notebook.show()
|
||||
# self.window.add(self.notebook)
|
||||
#interface_thread = ToggleInterface(self)
|
38
SettingsGUI/trunk/src/settingsgui/SysFSAccess.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
* SysFSAccess.py - SettingsGUI - tools to access SysFS
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
def set_sysfs_value(entry_dir, value):
|
||||
try:
|
||||
file_descriptor = open(entry_dir, 'w')
|
||||
except:
|
||||
return False
|
||||
file_descriptor.write("%d" % int(value))
|
||||
file_descriptor.close()
|
||||
return True
|
||||
|
||||
def get_sysfs_value(entry_dir):
|
||||
try:
|
||||
file_descriptor = open(entry_dir)
|
||||
except:
|
||||
return ""
|
||||
value = file_descriptor.read()
|
||||
file_descriptor.close()
|
||||
return value
|
0
SettingsGUI/trunk/src/settingsgui/__init__.py
Normal file
681
SettingsGUI/trunk/src/settingsgui/pppdConfigParser.py
Normal file
|
@ -0,0 +1,681 @@
|
|||
#!/usr/bin/python
|
||||
"""
|
||||
* pppdConfigParser.py - Parsing the configuration of a pppd peer
|
||||
*
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Thanks to Bartek Zdanowski for changing ATDT to ATD
|
||||
* and suggesting #99* as dial string
|
||||
*
|
||||
* ---
|
||||
* chat-script parsing is not complete at all
|
||||
* we just parse what we need for gprs for now...
|
||||
*
|
||||
* ---
|
||||
* Paramenters and how we parse them for now
|
||||
* (the once called "FREQUENTLY USED OPTIONS" in the pppd man page)
|
||||
*
|
||||
* NFC - not fully compatible (can not parse all variants yet)
|
||||
* FC - fully compatible (can parse all variants of the poarameter)
|
||||
* NFC? - manpage was not explicit enough
|
||||
*
|
||||
* ttyname - a string starting with /dev/ (NFC)
|
||||
* speed - a line only containing an integer (FC)
|
||||
* asyncmap <map> - 32 Bit Hex number (withoug "0x") default 0 (mask) (FC)
|
||||
* auth - flag - default False (FC)
|
||||
* call <name> - filename of a file from relative to current dir (FC)
|
||||
* connect <script> - filename of a file from relative to current dir (NFC?)
|
||||
* crtscts - flag - default empty (flow control unchanged) (FC)
|
||||
* nocrtscts - flag - default empty (flow control unchanged) (FC)
|
||||
* cdtrcts - flag - default empty (flow control unchanged) (FC)
|
||||
* nocdtrcts - flag - default empty (flow control unchanged) (FC)
|
||||
* defaultroute - flag - default False (prio +) (FC)
|
||||
* nodefaultroute - flag - default True (prio -) (FC)
|
||||
* replacedefaultroute - flag - default False (prio ++) (FC)
|
||||
* disconnect <script> - filename of a file from relative to current dir (NFC?)
|
||||
* escape <xx,yy,...> - list of hex values (8 Bit) (FC)
|
||||
* file <name> - filename of a file from relative to current dir (NFC?)
|
||||
* init <script> - filename of a file from relative to current dir (NFC?)
|
||||
* lock - flag - default False (FC)
|
||||
* mru <n> - int 128..16384 (IPv6: 1280..16384)-default 1500 (FC)
|
||||
* mtu <n> - int 128..16384 (IPv6: 1280..16384)-default 1500?(NFC?)
|
||||
* passive - flag - default False (FC)
|
||||
*
|
||||
* -- additional --
|
||||
* nodetach - flag - default False (FC) K
|
||||
* holdoff - int (FC)
|
||||
* noipdefault - flag - default False (FC)
|
||||
* ipcp-accept-local - flag - default False (FC)
|
||||
* novj - flag - default False (FC)
|
||||
* novjccomp - flag - default False (FC)
|
||||
* defaultroute - flag - default False (FC)
|
||||
* replacedefaultroute - flag - default False (FC)
|
||||
* lcp-echo-interval - int (FC)
|
||||
* lcp-echo-failure - int (FC)
|
||||
* noauth - flag - default False (FC)
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
import stat
|
||||
from GlobalConfiguration import *
|
||||
#from settingsgui.GlobalConfiguration import *
|
||||
|
||||
|
||||
def remove_quotations(string):
|
||||
return string.lstrip("\"").lstrip("'").lstrip("\"").rstrip("'").rstrip("\"").rstrip("'")
|
||||
|
||||
|
||||
class pppdConfigEntry:
|
||||
def __init__(self, value, default, entry_type, priority):
|
||||
self.value = value
|
||||
self.default = default
|
||||
self.entry_type = entry_type
|
||||
self.priority = priority
|
||||
|
||||
|
||||
class pppdConfigParser:
|
||||
def __init__(self, filename):
|
||||
## format is [value, default, is_flag, priority]
|
||||
self.pppd_config = {
|
||||
## specially parsed - single worded
|
||||
"ttyname": pppdConfigEntry("", "", "ttyname", 0),
|
||||
"speed": pppdConfigEntry(0, 0, "speed", 0),
|
||||
|
||||
## flags
|
||||
"auth": pppdConfigEntry(False, False, "flag", 0),
|
||||
"noauth": pppdConfigEntry(False, False, "flag", 0),
|
||||
"noipdefault": pppdConfigEntry(False, False, "flag", 0),
|
||||
"ipcp-accept-local": pppdConfigEntry(False, False, "flag", 0),
|
||||
"novj": pppdConfigEntry(False, False, "flag", 0),
|
||||
"novjccomp": pppdConfigEntry(False, False, "flag", 0),
|
||||
"defaultroute": pppdConfigEntry(False, False, "flag", 0),
|
||||
"replacedefaultroute": pppdConfigEntry(False, False, "flag", 0),
|
||||
"nodetach": pppdConfigEntry(False, False, "flag", 0),
|
||||
"noauth": pppdConfigEntry(False, True, "flag", 0),
|
||||
"crtscts": pppdConfigEntry(-1, -1, "flag", 1),
|
||||
"nocrtscts": pppdConfigEntry(-1, -1, "flag", 0),
|
||||
"cdtrcts": pppdConfigEntry(-1, -1, "flag", 1),
|
||||
"nocdtrcts": pppdConfigEntry(-1, -1, "flag", 0),
|
||||
"defaultroute": pppdConfigEntry(False, False, "flag", 1),
|
||||
"nodefaultroute": pppdConfigEntry(True, True, "flag", 0),
|
||||
"replacedefaultroute": pppdConfigEntry(False, False, "flag", 2),
|
||||
"lock": pppdConfigEntry(False, False, True, 0),
|
||||
"passive": pppdConfigEntry(False, False, True, 0),
|
||||
|
||||
## options with a singe filename (path) argument
|
||||
"call": pppdConfigEntry("", "", "path", 0),
|
||||
"connect": pppdConfigEntry("", "", "path", 0),
|
||||
"disconnect": pppdConfigEntry("", "", "path", 0),
|
||||
"file": pppdConfigEntry("", "", "path", 0),
|
||||
"init": pppdConfigEntry("", "", "path", 0),
|
||||
|
||||
## options with a single int argument
|
||||
"mru": pppdConfigEntry(1500, 1500, "int", 0),
|
||||
"mtu": pppdConfigEntry(1500, 1500, "int", 0),
|
||||
"holdoff": pppdConfigEntry(0, 0, "int", 0),
|
||||
"lcp-echo-failure": pppdConfigEntry(0, 0, "int", 0),
|
||||
"lcp-echo-failure": pppdConfigEntry(0, 0, "int", 0),
|
||||
|
||||
## options with a single string argument
|
||||
"user": pppdConfigEntry("", "", "string", 0),
|
||||
"password": pppdConfigEntry("", "", "string", 0),
|
||||
|
||||
## options with specially parsed arguments
|
||||
"asyncmap": pppdConfigEntry(0, 0, "asyncmap", 0),
|
||||
"escape": pppdConfigEntry([], [], "escape", 0),
|
||||
}
|
||||
self.connect_script = ""
|
||||
self.disconnect_script = ""
|
||||
self.secrets = {}
|
||||
self.parse_pppd_config(filename)
|
||||
self.parse_secrets(PPP_SECRETS_FILES)
|
||||
self.APN = ""
|
||||
self.number = ""
|
||||
self.config_name = ""
|
||||
|
||||
def generate_configuration(self, config_path, config_name, APN,
|
||||
user, password, number):
|
||||
pppd_config = self.pppd_config
|
||||
self.APN = APN
|
||||
self.config_name = config_name
|
||||
pppd_config["user"].value = user
|
||||
pppd_config["password"].value = password
|
||||
self.number = number.rstrip('#')
|
||||
pppd_config["connect"].value = "%s-connect-chat" % (config_path+config_name)
|
||||
pppd_config["disconnect"].value = "%s-disconnect-chat" % (config_path+config_name)
|
||||
self.write_pppd_config_to_file(pppd_config,
|
||||
os.path.join(config_path, config_name))
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def get_APN(self):
|
||||
if len (self.APN) >= 1:
|
||||
return self.APN
|
||||
if len(self.connect_script) >= 1:
|
||||
for line in self.connect_script:
|
||||
if line.upper().find("AT+CGDCONT=1") >= 0:
|
||||
APN = remove_quotations(line.split(',')[2])
|
||||
self.APN = APN
|
||||
return APN
|
||||
return ""
|
||||
|
||||
def get_number(self):
|
||||
if len (self.number) >= 1:
|
||||
return self.number
|
||||
|
||||
if len(self.connect_script) >= 1:
|
||||
for line in self.connect_script:
|
||||
if line.upper().find("ATD") >= 0\
|
||||
or line.upper().find("ATDT") >= 0:
|
||||
for word in line.split():
|
||||
if word.upper().find("ATDT") >= 0:
|
||||
self.number = word.lower().replace("atdt", "") + "#"
|
||||
return word.lower().replace("atdt", "") + "#"
|
||||
if word.upper().find("ATD") >= 0:
|
||||
self.number = word.lower().replace("atd", "") + "#"
|
||||
return word.lower().replace("atd", "") + "#"
|
||||
return ""
|
||||
|
||||
def get_user(self):
|
||||
return self.pppd_config["user"].value
|
||||
|
||||
def get_password(self):
|
||||
if len(self.pppd_config["password"].value) >= 1:
|
||||
return self.pppd_config["password"].value
|
||||
else:
|
||||
if self.secrets.has_key(self.pppd_config["user"].value):
|
||||
return self.secrets[self.pppd_config["user"].value]
|
||||
return ""
|
||||
|
||||
def parse_chat_script(self, filename):
|
||||
chat_script_lines = []
|
||||
try:
|
||||
file_handle = open(filename)
|
||||
except:
|
||||
print "could not open chat script %s - error in pppd config file!" % filename
|
||||
return []
|
||||
|
||||
# print "parsing chat script: %s" % filename
|
||||
|
||||
for line in file_handle.readlines():
|
||||
line = line.rstrip('\n')
|
||||
line = line.split('#')[0] # remove comments <- ToDo this ignores strings containing '#'!
|
||||
if len(line.split()) >= 1: # remove empty lines
|
||||
chat_script_lines.append(line.rstrip("\\").rstrip().lstrip())
|
||||
file_handle.close()
|
||||
return chat_script_lines
|
||||
|
||||
|
||||
## parsing secrets and placing the last found user/pass combination
|
||||
## into self.secrets
|
||||
## format is:
|
||||
## "user" ignored "pass"
|
||||
## while where ignoring everything other than user and path
|
||||
## - second argument has to be there use *
|
||||
def parse_secrets(self, secret_files):
|
||||
for filename in secret_files:
|
||||
if not os.path.exists(filename):
|
||||
break
|
||||
try:
|
||||
file_handle = open(filename)
|
||||
except:
|
||||
break
|
||||
# print "opened %s" % filename
|
||||
for line in file_handle.readlines():
|
||||
line = line.split('#')[0] # remove comments
|
||||
if len(line.split()) >= 3: # removing unvalid lines
|
||||
user = remove_quotations(line.split()[0])
|
||||
password = remove_quotations(line.split()[2])
|
||||
self.secrets[user] = password
|
||||
# print "added %s:%s" % (user, password)
|
||||
|
||||
|
||||
def parse_pppd_config(self, filename):
|
||||
file_handle = open(filename)
|
||||
for line in file_handle.readlines():
|
||||
line = line.rstrip('\n')
|
||||
line = line.split('#')[0] # remove comments
|
||||
if len(line.split()) >= 1: # remove empty lines
|
||||
self.set_value_from_line(line)
|
||||
file_handle.close()
|
||||
if len(self.pppd_config["connect"].value) > 0:
|
||||
self.connect_script = self.parse_chat_script(self.pppd_config["connect"].value)
|
||||
if len(self.pppd_config["disconnect"].value) > 0:
|
||||
self.disconnect_script = self.parse_chat_script(self.pppd_config["disconnect"].value)
|
||||
## ToDo: call, file, init
|
||||
|
||||
|
||||
def set_value_from_line(self, line):
|
||||
## no keyword in line - so not found in dictionary
|
||||
if line.split()[0].isdigit():
|
||||
self.pppd_config["speed"].value = int(line.split()[0])
|
||||
elif (len(line.split()) == 1) and (line.split()[0].startswith("/dev/")):
|
||||
self.pppd_config["ttyname"].value = line.split()[0]
|
||||
|
||||
for key in self.pppd_config.keys():
|
||||
if key == line.split()[0]: # split to only find whole words
|
||||
## flags
|
||||
if self.pppd_config[key].entry_type == "flag":
|
||||
self.pppd_config[key].value = True
|
||||
## options with argument(s)
|
||||
if len(line.split()) >= 2:
|
||||
if self.pppd_config[key].entry_type == "path":
|
||||
self.pppd_config[key].value = remove_quotations(line.split()[1])
|
||||
elif self.pppd_config[key].entry_type == "int":
|
||||
if remove_quotations(line.split()[1]).isdigit():
|
||||
self.pppd_config[key].value = int(remove_quotations(line.split()[1]))
|
||||
elif self.pppd_config[key].entry_type == "string":
|
||||
self.pppd_config[key].value = remove_quotations(line.split()[1])
|
||||
elif self.pppd_config[key].entry_type == "asyncmap":
|
||||
# no hex conversion needed - saved as string
|
||||
self.pppd_config[key].value = remove_quotations(line.split()[1])
|
||||
elif self.pppd_config[key].entry_type == "escape":
|
||||
self.pppd_config[key].value = remove_quotations(line.split()[1].lstrip("\""))
|
||||
|
||||
|
||||
def write_chat_script(self, script, filename):
|
||||
if script == "connect":
|
||||
filename = filename
|
||||
file_handle = open(filename, 'w')
|
||||
file_handle.write("#!/bin/sh\n")
|
||||
for line in PPP_DEFAULT_CONNECT_SCRIPT.split('\n'):
|
||||
if line.upper().find("AT+CGDCONT=1") >= 0:
|
||||
line = " OK 'at+cgdcont=1,\"ip\",\"%s\",\"0.0.0.0\",0,0'" % self.get_APN()
|
||||
if line.upper().find("ATD")>=0 or line.upper().find("ATDT")>=0:
|
||||
## the '#' is essential - and was removed as commend sign
|
||||
line = " OK atd%s#" % self.get_number()
|
||||
file_handle.write("%s\\\n" % line)
|
||||
file_handle.close()
|
||||
## make executable
|
||||
tmp_stat = stat.S_IMODE(os.stat(filename).st_mode)
|
||||
os.chmod(filename, tmp_stat | stat.S_IXUSR)
|
||||
print "wrote chat script to %s" % filename
|
||||
|
||||
if script == "disconnect":
|
||||
filename = filename
|
||||
file_handle = open(filename, 'w')
|
||||
file_handle.write("#!/bin/sh\n")
|
||||
for line in PPP_DEFAULT_CONNECT_SCRIPT.split('\n'):
|
||||
file_handle.write("%s\\\n" % line)
|
||||
file_handle.close()
|
||||
## make executable
|
||||
tmp_stat = stat.S_IMODE(os.stat(filename).st_mode)
|
||||
os.chmod(filename, tmp_stat | stat.S_IXUSR)
|
||||
print "wrote chat script to %s" % filename
|
||||
|
||||
|
||||
def write_pppd_config_to_file(self, pppd_config, filename):
|
||||
file_handle = open(filename, 'w')
|
||||
|
||||
file_handle.write("# pppd configuration file - generated by SettingGUI\n")
|
||||
file_handle.write("# bug reports to kristian-m@kristian-m.de\n\n")
|
||||
|
||||
if pppd_config["ttyname"].value != "":
|
||||
file_handle.write("%s\n" % pppd_config["ttyname"].value)
|
||||
|
||||
if pppd_config["speed"].value != 0:
|
||||
file_handle.write("%s\n" % pppd_config["speed"].value)
|
||||
|
||||
for key in pppd_config.keys():
|
||||
if pppd_config[key].value != pppd_config[key].default:
|
||||
## flags
|
||||
if pppd_config[key].entry_type == "flag":
|
||||
## key must be the flag name!
|
||||
if pppd_config[key].value:
|
||||
file_handle.write("%s\n" % key)
|
||||
## one string argument
|
||||
if ((pppd_config[key].entry_type == "int") or
|
||||
(pppd_config[key].entry_type == "string") or
|
||||
(pppd_config[key].entry_type == "asyncmap")):
|
||||
## key must be the option name!
|
||||
file_handle.write("%s %s\n" % (key, pppd_config[key].value))
|
||||
if key == "user":
|
||||
file_handle.write("%s %s\n" % ("password", self.get_password()))
|
||||
|
||||
## the escape list
|
||||
if pppd_config[key].entry_type == "escape":
|
||||
file_handle.write("%s %s\n" % (key,
|
||||
",".join(pppd_config[key].value)))
|
||||
if (pppd_config[key].entry_type == "path"):
|
||||
file_handle.write("%s %s\n" % (key, pppd_config[key].value))
|
||||
if key == "connect":
|
||||
self.write_chat_script("connect", pppd_config[key].value)
|
||||
if key == "disconnect":
|
||||
self.write_chat_script("disconnect", pppd_config[key].value)
|
||||
|
||||
## end of for loop
|
||||
file_handle.close()
|
||||
print "wrote pppd config file to %s" % filename
|
||||
|
||||
|
||||
"""
|
||||
ToDo, other options:
|
||||
|
||||
<local_IP_address>:<remote_IP_address>
|
||||
Set the local and/or remote interface IP addresses. Either one may be omitted. The IP addresses can be specified with a host name or in decimal dot notation (e.g. 150.234.56.78). The default local address is the (first) IP address of the system (unless the noipdefault option is given). The remote address will be obtained from the peer if not specified in any option. Thus, in simple cases, this option is not required. If a local and/or remote IP address is specified with this option, pppd will not accept a different value from the peer in the IPCP negotiation, unless the ipcp-accept-local and/or ipcp-accept-remote options are given, respectively.
|
||||
ipv6 <local_interface_identifier>,<remote_interface_identifier>
|
||||
Set the local and/or remote 64-bit interface identifier. Either one may be omitted. The identifier must be specified in standard ascii notation of IPv6 addresses (e.g. ::dead:beef). If the ipv6cp-use-ipaddr option is given, the local identifier is the local IPv4 address (see above). On systems which supports a unique persistent id, such as EUI-48 derived from the Ethernet MAC address, ipv6cp-use-persistent option can be used to replace the ipv6 <local>,<remote> option. Otherwise the identifier is randomized.
|
||||
active-filter filter-expression
|
||||
Specifies a packet filter to be applied to data packets to determine which packets are to be regarded as link activity, and therefore reset the idle timer, or cause the link to be brought up in demand-dialling mode. This option is useful in conjunction with the idle option if there are packets being sent or received regularly over the link (for example, routing information packets) which would otherwise prevent the link from ever appearing to be idle. The filter-expression syntax is as described for tcpdump(1), except that qualifiers which are inappropriate for a PPP link, such as ether and arp, are not permitted. Generally the filter expression should be enclosed in single-quotes to prevent whitespace in the expression from being interpreted by the shell. This option is currently only available under Linux, and requires that the kernel was configured to include PPP filtering support (CONFIG_PPP_FILTER). Note that it is possible to apply different constraints to incoming and outgoing packets using the inbound and outbound qualifiers.
|
||||
allow-ip address(es)
|
||||
Allow peers to use the given IP address or subnet without authenticating themselves. The parameter is parsed as for each element of the list of allowed IP addresses in the secrets files (see the AUTHENTICATION section below).
|
||||
allow-number number
|
||||
Allow peers to connect from the given telephone number. A trailing '*' character will match all numbers beginning with the leading part.
|
||||
bsdcomp nr,nt
|
||||
Request that the peer compress packets that it sends, using the BSD-Compress scheme, with a maximum code size of nr bits, and agree to compress packets sent to the peer with a maximum code size of nt bits. If nt is not specified, it defaults to the value given for nr. Values in the range 9 to 15 may be used for nr and nt; larger values give better compression but consume more kernel memory for compression dictionaries. Alternatively, a value of 0 for nr or nt disables compression in the corresponding direction. Use nobsdcomp or bsdcomp 0 to disable BSD-Compress compression entirely.
|
||||
cdtrcts
|
||||
Use a non-standard hardware flow control (i.e. DTR/CTS) to control the flow of data on the serial port. If neither the crtscts, the nocrtscts, the cdtrcts nor the nocdtrcts option is given, the hardware flow control setting for the serial port is left unchanged. Some serial ports (such as Macintosh serial ports) lack a true RTS output. Such serial ports use this mode to implement true bi-directional flow control. The sacrifice is that this flow control mode does not permit using DTR as a modem control line.
|
||||
chap-interval n
|
||||
If this option is given, pppd will rechallenge the peer every n seconds.
|
||||
chap-max-challenge n
|
||||
Set the maximum number of CHAP challenge transmissions to n (default 10).
|
||||
chap-restart n
|
||||
Set the CHAP restart interval (retransmission timeout for challenges) to n seconds (default 3).
|
||||
child-timeout n
|
||||
When exiting, wait for up to n seconds for any child processes (such as the command specified with the pty command) to exit before exiting. At the end of the timeout, pppd will send a SIGTERM signal to any remaining child processes and exit. A value of 0 means no timeout, that is, pppd will wait until all child processes have exited.
|
||||
connect-delay n
|
||||
Wait for up to n milliseconds after the connect script finishes for a valid PPP packet from the peer. At the end of this time, or when a valid PPP packet is received from the peer, pppd will commence negotiation by sending its first LCP packet. The default value is 1000 (1 second). This wait period only applies if the connect or pty option is used.
|
||||
debug
|
||||
Enables connection debugging facilities. If this option is given, pppd will log the contents of all control packets sent or received in a readable form. The packets are logged through syslog with facility daemon and level debug. This information can be directed to a file by setting up /etc/syslog.conf appropriately (see syslog.conf(5)).
|
||||
default-asyncmap
|
||||
Disable asyncmap negotiation, forcing all control characters to be escaped for both the transmit and the receive direction.
|
||||
default-mru
|
||||
Disable MRU [Maximum Receive Unit] negotiation. With this option, pppd will use the default MRU value of 1500 bytes for both the transmit and receive direction.
|
||||
deflate nr,nt
|
||||
Request that the peer compress packets that it sends, using the Deflate scheme, with a maximum window size of 2**nr bytes, and agree to compress packets sent to the peer with a maximum window size of 2**nt bytes. If nt is not specified, it defaults to the value given for nr. Values in the range 9 to 15 may be used for nr and nt; larger values give better compression but consume more kernel memory for compression dictionaries. Alternatively, a value of 0 for nr or nt disables compression in the corresponding direction. Use nodeflate or deflate 0 to disable Deflate compression entirely. (Note: pppd requests Deflate compression in preference to BSD-Compress if the peer can do either.)
|
||||
demand
|
||||
Initiate the link only on demand, i.e. when data traffic is present. With this option, the remote IP address must be specified by the user on the command line or in an options file. Pppd will initially configure the interface and enable it for IP traffic without connecting to the peer. When traffic is available, pppd will connect to the peer and perform negotiation, authentication, etc. When this is completed, pppd will commence passing data packets (i.e., IP packets) across the link.
|
||||
|
||||
The demand option implies the persist option. If this behaviour is not desired, use the nopersist option after the demand option. The idle and holdoff options are also useful in conjuction with the demand option.
|
||||
domain d
|
||||
Append the domain name d to the local host name for authentication purposes. For example, if gethostname() returns the name porsche, but the fully qualified domain name is porsche.Quotron.COM, you could specify domain Quotron.COM. Pppd would then use the name porsche.Quotron.COM for looking up secrets in the secrets file, and as the default name to send to the peer when authenticating itself to the peer. This option is privileged.
|
||||
dryrun
|
||||
With the dryrun option, pppd will print out all the option values which have been set and then exit, after parsing the command line and options files and checking the option values, but before initiating the link. The option values are logged at level info, and also printed to standard output unless the device on standard output is the device that pppd would be using to communicate with the peer.
|
||||
dump
|
||||
With the dump option, pppd will print out all the option values which have been set. This option is like the dryrun option except that pppd proceeds as normal rather than exiting.
|
||||
endpoint <epdisc>
|
||||
Sets the endpoint discriminator sent by the local machine to the peer during multilink negotiation to <epdisc>. The default is to use the MAC address of the first ethernet interface on the system, if any, otherwise the IPv4 address corresponding to the hostname, if any, provided it is not in the multicast or locally-assigned IP address ranges, or the localhost address. The endpoint discriminator can be the string null or of the form type:value, where type is a decimal number or one of the strings local, IP, MAC, magic, or phone. The value is an IP address in dotted-decimal notation for the IP type, or a string of bytes in hexadecimal, separated by periods or colons for the other types. For the MAC type, the value may also be the name of an ethernet or similar network interface. This option is currently only available under Linux.
|
||||
eap-interval n
|
||||
If this option is given and pppd authenticates the peer with EAP (i.e., is the server), pppd will restart EAP authentication every n seconds. For EAP SRP-SHA1, see also the srp-interval option, which enables lightweight rechallenge.
|
||||
eap-max-rreq n
|
||||
Set the maximum number of EAP Requests to which pppd will respond (as a client) without hearing EAP Success or Failure. (Default is 20.)
|
||||
eap-max-sreq n
|
||||
Set the maximum number of EAP Requests that pppd will issue (as a server) while attempting authentication. (Default is 10.)
|
||||
eap-restart n
|
||||
Set the retransmit timeout for EAP Requests when acting as a server (authenticator). (Default is 3 seconds.)
|
||||
eap-timeout n
|
||||
Set the maximum time to wait for the peer to send an EAP Request when acting as a client (authenticatee). (Default is 20 seconds.)
|
||||
hide-password
|
||||
When logging the contents of PAP packets, this option causes pppd to exclude the password string from the log. This is the default.
|
||||
holdoff n
|
||||
Specifies how many seconds to wait before re-initiating the link after it terminates. This option only has any effect if the persist or demand option is used. The holdoff period is not applied if the link was terminated because it was idle.
|
||||
idle n
|
||||
Specifies that pppd should disconnect if the link is idle for n seconds. The link is idle when no data packets (i.e. IP packets) are being sent or received. Note: it is not advisable to use this option with the persist option without the demand option. If the active-filter option is given, data packets which are rejected by the specified activity filter also count as the link being idle.
|
||||
ipcp-accept-local
|
||||
With this option, pppd will accept the peer's idea of our local IP address, even if the local IP address was specified in an option.
|
||||
ipcp-accept-remote
|
||||
With this option, pppd will accept the peer's idea of its (remote) IP address, even if the remote IP address was specified in an option.
|
||||
ipcp-max-configure n
|
||||
Set the maximum number of IPCP configure-request transmissions to n (default 10).
|
||||
ipcp-max-failure n
|
||||
Set the maximum number of IPCP configure-NAKs returned before starting to send configure-Rejects instead to n (default 10).
|
||||
ipcp-max-terminate n
|
||||
Set the maximum number of IPCP terminate-request transmissions to n (default 3).
|
||||
ipcp-restart n
|
||||
Set the IPCP restart interval (retransmission timeout) to n seconds (default 3).
|
||||
ipparam string
|
||||
Provides an extra parameter to the ip-up, ip-pre-up and ip-down scripts. If this option is given, the string supplied is given as the 6th parameter to those scripts.
|
||||
ipv6cp-max-configure n
|
||||
Set the maximum number of IPv6CP configure-request transmissions to n (default 10).
|
||||
ipv6cp-max-failure n
|
||||
Set the maximum number of IPv6CP configure-NAKs returned before starting to send configure-Rejects instead to n (default 10).
|
||||
ipv6cp-max-terminate n
|
||||
Set the maximum number of IPv6CP terminate-request transmissions to n (default 3).
|
||||
ipv6cp-restart n
|
||||
Set the IPv6CP restart interval (retransmission timeout) to n seconds (default 3).
|
||||
ipx
|
||||
Enable the IPXCP and IPX protocols. This option is presently only supported under Linux, and only if your kernel has been configured to include IPX support.
|
||||
ipx-network n
|
||||
Set the IPX network number in the IPXCP configure request frame to n, a hexadecimal number (without a leading 0x). There is no valid default. If this option is not specified, the network number is obtained from the peer. If the peer does not have the network number, the IPX protocol will not be started.
|
||||
ipx-node n:m
|
||||
Set the IPX node numbers. The two node numbers are separated from each other with a colon character. The first number n is the local node number. The second number m is the peer's node number. Each node number is a hexadecimal number, at most 10 digits long. The node numbers on the ipx-network must be unique. There is no valid default. If this option is not specified then the node numbers are obtained from the peer.
|
||||
ipx-router-name <string>
|
||||
Set the name of the router. This is a string and is sent to the peer as information data.
|
||||
ipx-routing n
|
||||
Set the routing protocol to be received by this option. More than one instance of ipx-routing may be specified. The 'none' option (0) may be specified as the only instance of ipx-routing. The values may be 0 for NONE, 2 for RIP/SAP, and 4 for NLSP.
|
||||
ipxcp-accept-local
|
||||
Accept the peer's NAK for the node number specified in the ipx-node option. If a node number was specified, and non-zero, the default is to insist that the value be used. If you include this option then you will permit the peer to override the entry of the node number.
|
||||
ipxcp-accept-network
|
||||
Accept the peer's NAK for the network number specified in the ipx-network option. If a network number was specified, and non-zero, the default is to insist that the value be used. If you include this option then you will permit the peer to override the entry of the node number.
|
||||
ipxcp-accept-remote
|
||||
Use the peer's network number specified in the configure request frame. If a node number was specified for the peer and this option was not specified, the peer will be forced to use the value which you have specified.
|
||||
ipxcp-max-configure n
|
||||
Set the maximum number of IPXCP configure request frames which the system will send to n. The default is 10.
|
||||
ipxcp-max-failure n
|
||||
Set the maximum number of IPXCP NAK frames which the local system will send before it rejects the options. The default value is 3.
|
||||
ipxcp-max-terminate n
|
||||
Set the maximum nuber of IPXCP terminate request frames before the local system considers that the peer is not listening to them. The default value is 3.
|
||||
kdebug n
|
||||
Enable debugging code in the kernel-level PPP driver. The argument values depend on the specific kernel driver, but in general a value of 1 will enable general kernel debug messages. (Note that these messages are usually only useful for debugging the kernel driver itself.) For the Linux 2.2.x kernel driver, the value is a sum of bits: 1 to enable general debug messages, 2 to request that the contents of received packets be printed, and 4 to request that the contents of transmitted packets be printed. On most systems, messages printed by the kernel are logged by syslog(1) to a file as directed in the /etc/syslog.conf configuration file.
|
||||
ktune
|
||||
Enables pppd to alter kernel settings as appropriate. Under Linux, pppd will enable IP forwarding (i.e. set /proc/sys/net/ipv4/ip_forward to 1) if the proxyarp option is used, and will enable the dynamic IP address option (i.e. set /proc/sys/net/ipv4/ip_dynaddr to 1) in demand mode if the local address changes.
|
||||
lcp-echo-failure n
|
||||
If this option is given, pppd will presume the peer to be dead if n LCP echo-requests are sent without receiving a valid LCP echo-reply. If this happens, pppd will terminate the connection. Use of this option requires a non-zero value for the lcp-echo-interval parameter. This option can be used to enable pppd to terminate after the physical connection has been broken (e.g., the modem has hung up) in situations where no hardware modem control lines are available.
|
||||
lcp-echo-interval n
|
||||
If this option is given, pppd will send an LCP echo-request frame to the peer every n seconds. Normally the peer should respond to the echo-request by sending an echo-reply. This option can be used with the lcp-echo-failure option to detect that the peer is no longer connected.
|
||||
lcp-max-configure n
|
||||
Set the maximum number of LCP configure-request transmissions to n (default 10).
|
||||
lcp-max-failure n
|
||||
Set the maximum number of LCP configure-NAKs returned before starting to send configure-Rejects instead to n (default 10).
|
||||
lcp-max-terminate n
|
||||
Set the maximum number of LCP terminate-request transmissions to n (default 3).
|
||||
lcp-restart n
|
||||
Set the LCP restart interval (retransmission timeout) to n seconds (default 3).
|
||||
linkname name
|
||||
Sets the logical name of the link to name. Pppd will create a file named ppp-name.pid in /var/run (or /etc/ppp on some systems) containing its process ID. This can be useful in determining which instance of pppd is responsible for the link to a given peer system. This is a privileged option.
|
||||
local
|
||||
Don't use the modem control lines. With this option, pppd will ignore the state of the CD (Carrier Detect) signal from the modem and will not change the state of the DTR (Data Terminal Ready) signal. This is the opposite of the modem option.
|
||||
logfd n
|
||||
Send log messages to file descriptor n. Pppd will send log messages to at most one file or file descriptor (as well as sending the log messages to syslog), so this option and the logfile option are mutually exclusive. The default is for pppd to send log messages to stdout (file descriptor 1), unless the serial port is already open on stdout.
|
||||
logfile filename
|
||||
Append log messages to the file filename (as well as sending the log messages to syslog). The file is opened with the privileges of the user who invoked pppd, in append mode.
|
||||
login
|
||||
Use the system password database for authenticating the peer using PAP, and record the user in the system wtmp file. Note that the peer must have an entry in the /etc/ppp/pap-secrets file as well as the system password database to be allowed access.
|
||||
maxconnect n
|
||||
Terminate the connection when it has been available for network traffic for n seconds (i.e. n seconds after the first network control protocol comes up).
|
||||
maxfail n
|
||||
Terminate after n consecutive failed connection attempts. A value of 0 means no limit. The default value is 10.
|
||||
modem
|
||||
Use the modem control lines. This option is the default. With this option, pppd will wait for the CD (Carrier Detect) signal from the modem to be asserted when opening the serial device (unless a connect script is specified), and it will drop the DTR (Data Terminal Ready) signal briefly when the connection is terminated and before executing the connect script. On Ultrix, this option implies hardware flow control, as for the crtscts option. This is the opposite of the local option.
|
||||
mp
|
||||
Enables the use of PPP multilink; this is an alias for the 'multilink' option. This option is currently only available under Linux.
|
||||
mppe-stateful
|
||||
Allow MPPE to use stateful mode. Stateless mode is still attempted first. The default is to disallow stateful mode.
|
||||
mpshortseq
|
||||
Enables the use of short (12-bit) sequence numbers in multilink headers, as opposed to 24-bit sequence numbers. This option is only available under Linux, and only has any effect if multilink is enabled (see the multilink option).
|
||||
mrru n
|
||||
Sets the Maximum Reconstructed Receive Unit to n. The MRRU is the maximum size for a received packet on a multilink bundle, and is analogous to the MRU for the individual links. This option is currently only available under Linux, and only has any effect if multilink is enabled (see the multilink option).
|
||||
ms-dns <addr>
|
||||
If pppd is acting as a server for Microsoft Windows clients, this option allows pppd to supply one or two DNS (Domain Name Server) addresses to the clients. The first instance of this option specifies the primary DNS address; the second instance (if given) specifies the secondary DNS address. (This option was present in some older versions of pppd under the name dns-addr.)
|
||||
ms-wins <addr>
|
||||
If pppd is acting as a server for Microsoft Windows or "Samba" clients, this option allows pppd to supply one or two WINS (Windows Internet Name Services) server addresses to the clients. The first instance of this option specifies the primary WINS address; the second instance (if given) specifies the secondary WINS address.
|
||||
multilink
|
||||
Enables the use of the PPP multilink protocol. If the peer also supports multilink, then this link can become part of a bundle between the local system and the peer. If there is an existing bundle to the peer, pppd will join this link to that bundle, otherwise pppd will create a new bundle. See the MULTILINK section below. This option is currently only available under Linux.
|
||||
name name
|
||||
Set the name of the local system for authentication purposes to name. This is a privileged option. With this option, pppd will use lines in the secrets files which have name as the second field when looking for a secret to use in authenticating the peer. In addition, unless overridden with the user option, name will be used as the name to send to the peer when authenticating the local system to the peer. (Note that pppd does not append the domain name to name.)
|
||||
noaccomp
|
||||
Disable Address/Control compression in both directions (send and receive).
|
||||
noauth
|
||||
Do not require the peer to authenticate itself. This option is privileged.
|
||||
nobsdcomp
|
||||
Disables BSD-Compress compression; pppd will not request or agree to compress packets using the BSD-Compress scheme.
|
||||
noccp
|
||||
Disable CCP (Compression Control Protocol) negotiation. This option should only be required if the peer is buggy and gets confused by requests from pppd for CCP negotiation.
|
||||
nocrtscts
|
||||
Disable hardware flow control (i.e. RTS/CTS) on the serial port. If neither the crtscts nor the nocrtscts nor the cdtrcts nor the nocdtrcts option is given, the hardware flow control setting for the serial port is left unchanged.
|
||||
nocdtrcts
|
||||
This option is a synonym for nocrtscts. Either of these options will disable both forms of hardware flow control.
|
||||
nodefaultroute
|
||||
Disable the defaultroute option. The system administrator who wishes to prevent users from creating default routes with pppd can do so by placing this option in the /etc/ppp/options file.
|
||||
nodeflate
|
||||
Disables Deflate compression; pppd will not request or agree to compress packets using the Deflate scheme.
|
||||
nodetach
|
||||
Don't detach from the controlling terminal. Without this option, if a serial device other than the terminal on the standard input is specified, pppd will fork to become a background process.
|
||||
noendpoint
|
||||
Disables pppd from sending an endpoint discriminator to the peer or accepting one from the peer (see the MULTILINK section below). This option should only be required if the peer is buggy.
|
||||
noip
|
||||
Disable IPCP negotiation and IP communication. This option should only be required if the peer is buggy and gets confused by requests from pppd for IPCP negotiation.
|
||||
noipv6
|
||||
Disable IPv6CP negotiation and IPv6 communication. This option should only be required if the peer is buggy and gets confused by requests from pppd for IPv6CP negotiation.
|
||||
noipdefault
|
||||
Disables the default behaviour when no local IP address is specified, which is to determine (if possible) the local IP address from the hostname. With this option, the peer will have to supply the local IP address during IPCP negotiation (unless it specified explicitly on the command line or in an options file).
|
||||
noipx
|
||||
Disable the IPXCP and IPX protocols. This option should only be required if the peer is buggy and gets confused by requests from pppd for IPXCP negotiation.
|
||||
noktune
|
||||
Opposite of the ktune option; disables pppd from changing system settings.
|
||||
nolock
|
||||
Opposite of the lock option; specifies that pppd should not create a UUCP-style lock file for the serial device. This option is privileged.
|
||||
nolog
|
||||
Do not send log messages to a file or file descriptor. This option cancels the logfd and logfile options.
|
||||
nomagic
|
||||
Disable magic number negotiation. With this option, pppd cannot detect a looped-back line. This option should only be needed if the peer is buggy.
|
||||
nomp
|
||||
Disables the use of PPP multilink. This option is currently only available under Linux.
|
||||
nomppe
|
||||
Disables MPPE (Microsoft Point to Point Encryption). This is the default.
|
||||
nomppe-40
|
||||
Disable 40-bit encryption with MPPE.
|
||||
nomppe-128
|
||||
Disable 128-bit encryption with MPPE.
|
||||
nomppe-stateful
|
||||
Disable MPPE stateful mode. This is the default.
|
||||
nompshortseq
|
||||
Disables the use of short (12-bit) sequence numbers in the PPP multilink protocol, forcing the use of 24-bit sequence numbers. This option is currently only available under Linux, and only has any effect if multilink is enabled.
|
||||
nomultilink
|
||||
Disables the use of PPP multilink. This option is currently only available under Linux.
|
||||
nopcomp
|
||||
Disable protocol field compression negotiation in both the receive and the transmit direction.
|
||||
nopersist
|
||||
Exit once a connection has been made and terminated. This is the default unless the persist or demand option has been specified.
|
||||
nopredictor1
|
||||
Do not accept or agree to Predictor-1 compression.
|
||||
noproxyarp
|
||||
Disable the proxyarp option. The system administrator who wishes to prevent users from creating proxy ARP entries with pppd can do so by placing this option in the /etc/ppp/options file.
|
||||
notty
|
||||
Normally, pppd requires a terminal device. With this option, pppd will allocate itself a pseudo-tty master/slave pair and use the slave as its terminal device. Pppd will create a child process to act as a 'character shunt' to transfer characters between the pseudo-tty master and its standard input and output. Thus pppd will transmit characters on its standard output and receive characters on its standard input even if they are not terminal devices. This option increases the latency and CPU overhead of transferring data over the ppp interface as all of the characters sent and received must flow through the character shunt process. An explicit device name may not be given if this option is used.
|
||||
novj
|
||||
Disable Van Jacobson style TCP/IP header compression in both the transmit and the receive direction.
|
||||
novjccomp
|
||||
Disable the connection-ID compression option in Van Jacobson style TCP/IP header compression. With this option, pppd will not omit the connection-ID byte from Van Jacobson compressed TCP/IP headers, nor ask the peer to do so.
|
||||
papcrypt
|
||||
Indicates that all secrets in the /etc/ppp/pap-secrets file which are used for checking the identity of the peer are encrypted, and thus pppd should not accept a password which, before encryption, is identical to the secret from the /etc/ppp/pap-secrets file.
|
||||
pap-max-authreq n
|
||||
Set the maximum number of PAP authenticate-request transmissions to n (default 10).
|
||||
pap-restart n
|
||||
Set the PAP restart interval (retransmission timeout) to n seconds (default 3).
|
||||
pap-timeout n
|
||||
Set the maximum time that pppd will wait for the peer to authenticate itself with PAP to n seconds (0 means no limit).
|
||||
pass-filter filter-expression
|
||||
Specifies a packet filter to applied to data packets being sent or received to determine which packets should be allowed to pass. Packets which are rejected by the filter are silently discarded. This option can be used to prevent specific network daemons (such as routed) using up link bandwidth, or to provide a very basic firewall capability. The filter-expression syntax is as described for tcpdump(1), except that qualifiers which are inappropriate for a PPP link, such as ether and arp, are not permitted. Generally the filter expression should be enclosed in single-quotes to prevent whitespace in the expression from being interpreted by the shell. Note that it is possible to apply different constraints to incoming and outgoing packets using the inbound and outbound qualifiers. This option is currently only available under Linux, and requires that the kernel was configured to include PPP filtering support (CONFIG_PPP_FILTER).
|
||||
password password-string
|
||||
Specifies the password to use for authenticating to the peer. Use of this option is discouraged, as the password is likely to be visible to other users on the system (for example, by using ps(1)).
|
||||
persist
|
||||
Do not exit after a connection is terminated; instead try to reopen the connection. The maxfail option still has an effect on persistent connections.
|
||||
plugin filename
|
||||
Load the shared library object file filename as a plugin. This is a privileged option. If filename does not contain a slash (/), pppd will look in the /usr/lib/pppd/version directory for the plugin, where version is the version number of pppd (for example, 2.4.2).
|
||||
predictor1
|
||||
Request that the peer compress frames that it sends using Predictor-1 compression, and agree to compress transmitted frames with Predictor-1 if requested. This option has no effect unless the kernel driver supports Predictor-1 compression.
|
||||
privgroup group-name
|
||||
Allows members of group group-name to use privileged options. This is a privileged option. Use of this option requires care as there is no guarantee that members of group-name cannot use pppd to become root themselves. Consider it equivalent to putting the members of group-name in the kmem or disk group.
|
||||
proxyarp
|
||||
Add an entry to this system's ARP [Address Resolution Protocol] table with the IP address of the peer and the Ethernet address of this system. This will have the effect of making the peer appear to other systems to be on the local ethernet.
|
||||
pty script
|
||||
Specifies that the command script is to be used to communicate rather than a specific terminal device. Pppd will allocate itself a pseudo-tty master/slave pair and use the slave as its terminal device. The script will be run in a child process with the pseudo-tty master as its standard input and output. An explicit device name may not be given if this option is used. (Note: if the record option is used in conjuction with the pty option, the child process will have pipes on its standard input and output.)
|
||||
receive-all
|
||||
With this option, pppd will accept all control characters from the peer, including those marked in the receive asyncmap. Without this option, pppd will discard those characters as specified in RFC1662. This option should only be needed if the peer is buggy.
|
||||
record filename
|
||||
Specifies that pppd should record all characters sent and received to a file named filename. This file is opened in append mode, using the user's user-ID and permissions. This option is implemented using a pseudo-tty and a process to transfer characters between the pseudo-tty and the real serial device, so it will increase the latency and CPU overhead of transferring data over the ppp interface. The characters are stored in a tagged format with timestamps, which can be displayed in readable form using the pppdump(8) program.
|
||||
remotename name
|
||||
Set the assumed name of the remote system for authentication purposes to name.
|
||||
remotenumber number
|
||||
Set the assumed telephone number of the remote system for authentication purposes to number.
|
||||
refuse-chap
|
||||
With this option, pppd will not agree to authenticate itself to the peer using CHAP.
|
||||
refuse-mschap
|
||||
With this option, pppd will not agree to authenticate itself to the peer using MS-CHAP.
|
||||
refuse-mschap-v2
|
||||
With this option, pppd will not agree to authenticate itself to the peer using MS-CHAPv2.
|
||||
refuse-eap
|
||||
With this option, pppd will not agree to authenticate itself to the peer using EAP.
|
||||
refuse-pap
|
||||
With this option, pppd will not agree to authenticate itself to the peer using PAP.
|
||||
require-chap
|
||||
Require the peer to authenticate itself using CHAP [Challenge Handshake Authentication Protocol] authentication.
|
||||
require-mppe
|
||||
Require the use of MPPE (Microsoft Point to Point Encryption). This option disables all other compression types. This option enables both 40-bit and 128-bit encryption. In order for MPPE to successfully come up, you must have authenticated with either MS-CHAP or MS-CHAPv2. This option is presently only supported under Linux, and only if your kernel has been configured to include MPPE support.
|
||||
require-mppe-40
|
||||
Require the use of MPPE, with 40-bit encryption.
|
||||
require-mppe-128
|
||||
Require the use of MPPE, with 128-bit encryption.
|
||||
require-mschap
|
||||
Require the peer to authenticate itself using MS-CHAP [Microsoft Challenge Handshake Authentication Protocol] authentication.
|
||||
require-mschap-v2
|
||||
Require the peer to authenticate itself using MS-CHAPv2 [Microsoft Challenge Handshake Authentication Protocol, Version 2] authentication.
|
||||
require-eap
|
||||
Require the peer to authenticate itself using EAP [Extensible Authentication Protocol] authentication.
|
||||
require-pap
|
||||
Require the peer to authenticate itself using PAP [Password Authentication Protocol] authentication.
|
||||
show-password
|
||||
When logging the contents of PAP packets, this option causes pppd to show the password string in the log message.
|
||||
silent
|
||||
With this option, pppd will not transmit LCP packets to initiate a connection until a valid LCP packet is received from the peer (as for the 'passive' option with ancient versions of pppd).
|
||||
srp-interval n
|
||||
If this parameter is given and pppd uses EAP SRP-SHA1 to authenticate the peer (i.e., is the server), then pppd will use the optional lightweight SRP rechallenge mechanism at intervals of n seconds. This option is faster than eap-interval reauthentication because it uses a hash-based mechanism and does not derive a new session key.
|
||||
srp-pn-secret string
|
||||
Set the long-term pseudonym-generating secret for the server. This value is optional and if set, needs to be known at the server (authenticator) side only, and should be different for each server (or poll of identical servers). It is used along with the current date to generate a key to encrypt and decrypt the client's identity contained in the pseudonym.
|
||||
srp-use-pseudonym
|
||||
When operating as an EAP SRP-SHA1 client, attempt to use the pseudonym stored in ~/.ppp_psuedonym first as the identity, and save in this file any pseudonym offered by the peer during authentication.
|
||||
sync
|
||||
Use synchronous HDLC serial encoding instead of asynchronous. The device used by pppd with this option must have sync support. Currently supports Microgate SyncLink adapters under Linux and FreeBSD 2.2.8 and later.
|
||||
unit num
|
||||
Sets the ppp unit number (for a ppp0 or ppp1 etc interface name) for outbound connections.
|
||||
updetach
|
||||
With this option, pppd will detach from its controlling terminal once it has successfully established the ppp connection (to the point where the first network control protocol, usually the IP control protocol, has come up).
|
||||
usehostname
|
||||
Enforce the use of the hostname (with domain name appended, if given) as the name of the local system for authentication purposes (overrides the name option). This option is not normally needed since the name option is privileged.
|
||||
usepeerdns
|
||||
Ask the peer for up to 2 DNS server addresses. The addresses supplied by the peer (if any) are passed to the /etc/ppp/ip-up script in the environment variables DNS1 and DNS2, and the environment variable USEPEERDNS will be set to 1. In addition, pppd will create an /var/run/ppp/resolv.conf file containing one or two nameserver lines with the address(es) supplied by the peer.
|
||||
user name
|
||||
Sets the name used for authenticating the local system to the peer to name.
|
||||
vj-max-slots n
|
||||
Sets the number of connection slots to be used by the Van Jacobson TCP/IP header compression and decompression code to n, which must be between 2 and 16 (inclusive).
|
||||
welcome script
|
||||
Run the executable or shell command specified by script before initiating PPP negotiation, after the connect script (if any) has completed. A value for this option from a privileged source cannot be overridden by a non-privileged user.
|
||||
xonxoff
|
||||
Use software flow control (i.e. XON/XOFF) to control the flow of data on the serial port.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
14
SettingsGUI/trunk/src/setup.cfg
Normal file
|
@ -0,0 +1,14 @@
|
|||
# This config file installs SettingsGUI in /usr
|
||||
# Replace /usr by /usr/local if you prefer
|
||||
|
||||
[install]
|
||||
#install-scripts = /usr/bin
|
||||
#install-data = /usr/share
|
||||
|
||||
[install_lib]
|
||||
compile = 1
|
||||
optimize = 1
|
||||
|
||||
[sdist]
|
||||
force-manifest = 1
|
||||
formats = bztar
|
42
SettingsGUI/trunk/src/setup.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python
|
||||
"""
|
||||
* setup.py - script to install SettingGUI
|
||||
* (C) 2007 by Kristian Mueller <kristian-m@kristian-m.de>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
"""
|
||||
|
||||
from distutils.core import setup
|
||||
import os
|
||||
|
||||
setup(name='settingsgui',
|
||||
description='GUI to set system options in OpenMoko',
|
||||
long_description='User Interface to access display, audio and network setting on FIC Neo1973 (OpenMoko Distribution)',
|
||||
author='Kristian Mueller',
|
||||
author_email='kristian-m@kristian-m.de',
|
||||
url='http://mput.de/projects/code/settingsgui/',
|
||||
version='0.8',
|
||||
license='GPL_v2',
|
||||
scripts=['settings'],
|
||||
# package_dir = {"settingsgui" : ""},
|
||||
packages = ["settingsgui"],
|
||||
# py_modules=['settingsgui.AudioPanel', 'settingsgui.GPRSPanel', 'settingsgui.pppdConfigParser',
|
||||
# 'settingsgui.ScreenPanel', 'settingsgui.GlobalConfiguration', 'settingsgui.GSMPanel',
|
||||
# 'settingsgui.ProcessInterface', 'settingsgui.SettingsGUI', 'settingsgui.SysFSAccess',
|
||||
# 'settingsgui.settingsgui', 'settingsgui.__init__.py',],
|
||||
)
|
||||
|
||||
# 70: packages = ["slune"],
|