-
Notifications
You must be signed in to change notification settings - Fork 0
/
eciadsl-config-tk.in
executable file
·1113 lines (963 loc) · 40.8 KB
/
eciadsl-config-tk.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/wish
# ****************************************************************************
# * *
# * eciadsl-config-tk - Tcl/tk GUI for ECI Linux driver configuration *
# * (c) 2002/04/14 by FlashCode and Crevetor *
# * *
# * http://eciadsl.flashtux.org *
# * *
# ****************************************************************************
#
# 2004/04/17, FlashCode :
# Renamed script to eciadsl-config-tk
# 2002/11/03, FlashCode :
# Added 3 providers : Infostrada, Sunrise, Econophone
# 2002/10/19, FlashCode :
# Added Belgacom provider
# 2002/10/07, FlashCode :
# Added modem Zyxel Prestige 630-41 and provider Bluewin
# 2002/10/05, FlashCode :
# Added modems US Robotics 8500, BT Voyager, Xentrix USB
# 2002/06/13, FlashCode :
# Added modem selection
# 2002/05/19, FlashCode :
# Added .bin selection
# 2004/10/19 kolja :
# Added support for GS7470 modems chipset
# \
exec wish "$0" "$@" & exit 0
# <CONFIG>
set BIN_DIR "@bindir@"
set ETC_DIR "@sysconfdir@"
set CONF_DIR "@sysconfdir@/eciadsl"
set PPPD_DIR "@sysconfdir@/ppp"
set VERSION "@PACKAGE_VERSION@"
# </CONFIG>
set titre_fenetre "ECI Linux driver configuration v$VERSION"
wm title . $titre_fenetre
#
# ===== Check is user is 'root' =====
#
catch {exec id -u} current_user
if {$current_user != 0} {
frame .baduser
message .baduser.texte -text "You must be root in order to run the ECI Linux driver configuration." -aspect 900 -padx 15 -pady 15
button .baduser.ok -text { O K } -command {exit}
pack .baduser.texte .baduser.ok -side top
pack configure .baduser.ok -pady 15
pack .baduser
tkwait window .
exit
}
# default values
set username "username@domain"
set password ""
set vpi "8"
set vci "35"
set dns1 ""
set dns2 ""
set vid1 ""
set pid1 ""
set vid2 ""
set pid2 ""
set use_dhcp "no"
set use_staticip "no"
set staticip ""
set gateway ""
set mode ""
set synch ""
set firm ""
set modem ""
set chipset "GS7070"
set altsynch ""
set altpppoeci ""
set provider ""
# try to get previously defined values
set file -1
catch {set file [open "$CONF_DIR/eciadsl.conf" r]}
if {$file!=-1} {
fconfigure $file -buffering line
while {[eof $file]!=1} {
set line [string trim [gets $file]]
regsub -all {[\t]+} $line { } line
set line [string trim $line]
if {"$line"!="" && ![regexp {^#} $line]} {
set pos1 0
set pos2 [string first "=" "$line" [expr $pos1+1]]
if {$pos2!=-1} {
# skip trailing blanks
set pos2 [expr $pos2-1]
} else {
set pos2 end
}
set entry [string trim [string range "$line" $pos1 $pos2]]
set value [string trim [string range "$line" [expr $pos2+2] end]]
switch $entry {
PPPD_USER { set username "$value" }
PPPD_PASSWD { set password "$value" }
VID1 { set vid1 "$value" }
PID1 { set pid1 "$value" }
VID2 { set vid2 "$value" }
PID2 { set pid2 "$value" }
VPI { set vpi "$value" }
VCI { set vci "$value" }
MODE { set mode "$value" }
SYNCH { set synch "$value" }
FIRM { set firm "$value" }
USE_DHCP { set use_dhcp "$value" }
USE_STATICIP { set use_staticip "$value" }
STATICIP { set staticip "$value" }
GATEWAY { set gateway "$value" }
MODEM { set modem "$value" }
MODEM_CHIPSET { set chipset "$value" }
SYNCH_ALTIFACE { set altsynch "$value" }
PPPOECI_ALTIFACE { set altpppoeci "$value" }
PROVIDER { set provider "$value" }
DNS1 { set dns1 "$value" }
DNS2 { set dns2 "$value" }
}
}
}
close $file
}
#
# ===== modem logo =====
#
frame .bloc0
frame .bloc0.logo
image create photo modem_eci -file "$CONF_DIR/modemeci.gif"
label .bloc0.logo.picture -image modem_eci
bind .bloc0.logo.picture <Enter> {pushstate "ECI HiFocus USB ADSL modem"}
bind .bloc0.logo.picture <Leave> {popstate}
pack .bloc0.logo.picture
#
# ===== user and password =====
#
frame .bloc0.ident
frame .bloc0.ident.user
label .bloc0.ident.user.label -text {User:} -width 15 -anchor e
entry .bloc0.ident.user.edit -textvariable username -background lightblue -width 17
bind .bloc0.ident.user.edit <Enter> {pushstate "Enter your username and domain (given by your provider)"}
bind .bloc0.ident.user.edit <Leave> {popstate}
pack .bloc0.ident.user.label .bloc0.ident.user.edit -side left
frame .bloc0.ident.password
label .bloc0.ident.password.label -text {Password:} -width 15 -anchor e
entry .bloc0.ident.password.edit -show * -textvariable password -background lightblue -width 17
bind .bloc0.ident.password.edit <Enter> {pushstate "Enter your password (given by your provider)"}
bind .bloc0.ident.password.edit <Leave> {popstate}
pack .bloc0.ident.password.label .bloc0.ident.password.edit -side left
pack .bloc0.ident.user .bloc0.ident.password
#
# ===== VPI/VCI =====
# ===== ALT IFACES =====
#
frame .bloc0.call
frame .bloc0.call.vpi
label .bloc0.call.vpi.label -text {VPI:} -width 10 -anchor e
entry .bloc0.call.vpi.edit -textvariable vpi -background lightblue -width 4
bind .bloc0.call.vpi.edit <Enter> {pushstate "Virtual Path Identifier of your provider (8 for France)"}
bind .bloc0.call.vpi.edit <Leave> {popstate}
pack .bloc0.call.vpi.label .bloc0.call.vpi.edit -side left
frame .bloc0.call.vci
label .bloc0.call.vci.label -text {VCI:} -width 10 -anchor e
entry .bloc0.call.vci.edit -textvariable vci -background lightblue -width 4
bind .bloc0.call.vci.edit <Enter> {pushstate "Virtual Channel Identifier of your provider (35 for France)"}
bind .bloc0.call.vci.edit <Leave> {popstate}
pack .bloc0.call.vci.label .bloc0.call.vci.edit -side left
pack .bloc0.call.vpi .bloc0.call.vci
pack .bloc0 .bloc0.logo .bloc0.ident .bloc0.call -side left
pack .bloc0 -side top
#
# ===== provider DNS selection =====
#
frame .bloc1
frame .bloc1.espace1 -width 15
frame .bloc1.fai
frame .bloc1.fai.majdns
checkbutton .bloc1.fai.majdns.checkbox -text { Update provider DNS:} -command {invert_fai} -relief groove -background "#ffcc99" -width 28 -variable majfai -offvalue "non" -onvalue "oui" -selectcolor blue
bind .bloc1.fai.majdns.checkbox <Enter> {pushstate "Check this box if you want to update your DNS ($ETC_DIR/resolv.conf)"}
bind .bloc1.fai.majdns.checkbox <Leave> {popstate}
pack .bloc1.fai.majdns.checkbox -side left
pack .bloc1.fai.majdns -side top -anchor w
# build the list of providers
list providers
set file [open "$CONF_DIR/providers.db" r]
fconfigure $file -buffering line
while {[eof $file]!=1} {
set line [string trim [gets $file]]
regsub -all {[\t]+} $line {^} line
if {"$line"!="" && "$line"!="^" && ![regexp {^[ \t]*#} $line]} {
set pos1 0
set pos2 [string first "^" "$line" [expr $pos1+1]]
set pos3 [string first "^" "$line" [expr $pos2+1]]
set pos4 [string first "^" "$line" [expr $pos3+1]]
if {$pos4!=-1} {
# skip trailing blanks
set pos4 [expr $pos4-1]
} else {
set pos4 end
}
lappend providers [string trim [string range "$line" $pos1 [expr $pos2-1]]]
lappend providers [string trim [string range "$line" [expr $pos2+1] [expr $pos3-1]]]
lappend providers [string trim [string range "$line" [expr $pos3+1] $pos4]]
}
}
close $file
lappend providers "Other" "" ""
# fill the widget with the list of providers
frame .bloc1.fai.liste
listbox .bloc1.fai.liste.contenu -yscrollcommand {.bloc1.fai.liste.scroll set} -width 27 -height 7 -foreground black -selectbackground "#00ccff" -selectforeground black
.bloc1.fai.liste.contenu configure -exportselection 0
set i 0
set len [llength $providers]
while {$i<$len} {
.bloc1.fai.liste.contenu insert end [lindex $providers $i]
incr i 3
}
# previously defined provider set?
if {"$provider"!=""} {
set selected_provider [expr [lsearch $providers $provider]/3]
if {$selected_provider!=-1} {
set dns1_other [lindex $providers [expr $selected_provider*3+1]]
set dns2_other [lindex $providers [expr $selected_provider*3+2]]
# if dns don't match the provider name
if {"$dns1"!="$dns1_other" || "$dns2"!="$dns2_other"} {
set selected_provider -1
} else {
.bloc1.fai.liste.contenu selection set $selected_provider
.bloc1.fai.liste.contenu see [.bloc1.fai.liste.contenu curselection]
}
}
} else {
set selected_provider -1
}
set dns1_other ""
set dns2_other ""
# no previous provider or bad one
if {"$provider"=="" || $selected_provider==-1} {
# set Other provider if at least one DNS has been set
if {"$dns1"!="" || "$dns2"!=""} {
set provider "Other"
.bloc1.fai.liste.contenu selection set [expr $len/3-1]
.bloc1.fai.liste.contenu see [.bloc1.fai.liste.contenu curselection]
}
}
scrollbar .bloc1.fai.liste.scroll -command ".bloc1.fai.liste.contenu yview"
pack .bloc1.fai.liste.contenu .bloc1.fai.liste.scroll -side left -fill y
pack .bloc1.fai.liste
frame .bloc1.fai.espacevertic -height 5
pack .bloc1.fai.espacevertic
frame .bloc1.fai.dns1
label .bloc1.fai.dns1.label -text "DNS 1: " -width 8
entry .bloc1.fai.dns1.entry -textvariable dns1 -background lightblue -width 15
pack .bloc1.fai.dns1.label .bloc1.fai.dns1.entry -side left
pack .bloc1.fai.dns1
frame .bloc1.fai.dns2
label .bloc1.fai.dns2.label -text "DNS 2: " -width 8
entry .bloc1.fai.dns2.entry -textvariable dns2 -background lightblue -width 15
pack .bloc1.fai.dns2.label .bloc1.fai.dns2.entry -side left -anchor e
pack .bloc1.fai.dns2
.bloc1.fai.liste.contenu configure -foreground darkgray -selectbackground lightgray -selectforeground darkgray
.bloc1.fai.dns1.entry configure -state disabled -foreground darkgray -background lightgray
.bloc1.fai.dns2.entry configure -state disabled -foreground darkgray -background lightgray
.bloc1.fai.dns1.label configure -foreground darkgray
.bloc1.fai.dns2.label configure -foreground darkgray
set majfai "non"
set fai_choisi ""
bind .bloc1.fai.liste.contenu <ButtonRelease> {select_provider}
bind .bloc1.fai.liste.contenu <Enter> {pushstate "Select a provider"}
bind .bloc1.fai.liste.contenu <Leave> {popstate}
bind .bloc1.fai.dns1 <Enter> {pushstate "\[OPTIONAL\] Enter your own primary DNS (given by your provider)"}
bind .bloc1.fai.dns1 <Leave> {popstate}
bind .bloc1.fai.dns2 <Enter> {pushstate "\[OPTIONAL\] Enter your own secondary DNS (given by your provider)"}
bind .bloc1.fai.dns2 <Leave> {popstate}
frame .bloc1.espace2 -width 15
#
# ===== modem selection =====
#
frame .bloc1.modem
label .bloc1.modem.libelle -text "Select your modem:" -relief groove -background "#ffcc99" -width 60
pack .bloc1.modem.libelle
# build the list of modems
list modems
set file [open "$CONF_DIR/modems.db" r]
fconfigure $file -buffering line
while {[eof $file]!=1} {
set line [string trim [gets $file]]
regsub -all {[\t]+} $line {^} line
if {"$line"!="" && "$line"!="^" && ![regexp {^[ \t]*#} $line]} {
set pos1 0
set pos2 [string first "^" "$line" [expr $pos1+1]]
set pos3 [string first "^" "$line" [expr $pos2+1]]
set pos4 [string first "^" "$line" [expr $pos3+1]]
set pos5 [string first "^" "$line" [expr $pos4+1]]
set pos6 [string first "^" "$line" [expr $pos5+1]]
set pos7 [string first "^" "$line" [expr $pos6+1]]
set pos8 [string first "^" "$line" [expr $pos7+1]]
set pos9 [string first "^" "$line" [expr $pos8+1]]
if {$pos9!=-1} {
# skip trailing blanks
set pos9 [expr $pos9-1]
} else {
set pos9 end
}
lappend modems [string trim [string range "$line" $pos1 [expr $pos2-1]]]
lappend modems [string trim [string range "$line" [expr $pos2+1] [expr $pos3-1]]]
lappend modems [string trim [string range "$line" [expr $pos3+1] [expr $pos4-1]]]
lappend modems [string trim [string range "$line" [expr $pos4+1] [expr $pos5-1]]]
lappend modems [string trim [string range "$line" [expr $pos5+1] [expr $pos6-1]]]
lappend modems [string trim [string range "$line" [expr $pos6+1] [expr $pos7-1]]]
lappend modems [string trim [string range "$line" [expr $pos7+1] [expr $pos8-1]]]
lappend modems [string trim [string range "$line" [expr $pos8+1] $pos9]]
}
}
close $file
lappend modems "Other" "" "" "" "" "" "" ""
# fill the widget with the list of modems
frame .bloc1.modem.liste
listbox .bloc1.modem.liste.contenu -yscrollcommand {.bloc1.modem.liste.scroll set} -width 57 -height 7 -foreground black -selectbackground "#00ccff" -selectforeground black
.bloc1.modem.liste.contenu configure -exportselection 0
set i 0
set len [llength $modems]
while {$i<$len} {
.bloc1.modem.liste.contenu insert end [lindex $modems $i]
incr i 8
}
# previously defined modem set?
if {"$modem"!=""} {
set selected_modem [expr [lsearch $modems $modem]/8]
if {$selected_modem!=-1} {
set vid1_other [lindex $modems [expr $selected_modem*8+1]]
set pid1_other [lindex $modems [expr $selected_modem*8+2]]
set vid2_other [lindex $modems [expr $selected_modem*8+3]]
set pid2_other [lindex $modems [expr $selected_modem*8+4]]
set chipset_other [lindex $modems [expr $selected_modem*8+5]]
set altsynch_other [lindex $modems [expr $selected_modem*8+6]]
set altpppoeci_other [lindex $modems [expr $selected_modem*8+7]]
# if vidpid don't match the modem name
if {"$vid1"!="$vid1_other" || "$pid1"!="$pid1_other" || "$vid2"!="$vid2_other" || "$pid2"!="$pid2_other" || "$chipset"!="$chipset_other" || "$altsynch"!="$altsynch_other" || "$altpppoeci"!="$altpppoeci_other"} {
set selected_modem -1
} else {
.bloc1.modem.liste.contenu selection set $selected_modem
.bloc1.modem.liste.contenu see [.bloc1.modem.liste.contenu curselection]
}
}
} else {
set selected_modem -1
}
set vid1_other ""
set pid1_other ""
set vid2_other ""
set pid2_other ""
set chipset_other ""
set altsynch_other ""
set altpppoeci_other ""
# no previous modem or bad one
if {"$modem"=="" || $selected_modem==-1} {
# set Other provider if at least one VID/PID has been set
if {"$vid1"!="" || "$pid1"!="" || "$vid2"!="" || "$pid2"!="" || "$chipset"!="" || "$altsynch"!="" || "$altpppoeci"!=""} {
set modem "Other"
.bloc1.modem.liste.contenu selection set [expr $len/8-1]
.bloc1.modem.liste.contenu see [.bloc1.modem.liste.contenu curselection]
}
}
scrollbar .bloc1.modem.liste.scroll -command ".bloc1.modem.liste.contenu yview"
pack .bloc1.modem.liste.contenu .bloc1.modem.liste.scroll -side left -fill y
pack .bloc1.modem.liste
frame .bloc1.modem.espacevertic -height 5
pack .bloc1.modem.espacevertic
#=== CHIPSET ===
# build the list of chipsets
list chipsets
lappend chipsets "GS7070"
lappend chipsets "GS7470"
# fill the widget with the list of chipset
frame .bloc1.modem.lchipset
label .bloc1.modem.lchipset.label -text {CHIPSET:} -width 8 -height 2 -anchor nw
listbox .bloc1.modem.lchipset.contenu -width 7 -height 2 -foreground black -selectbackground "#00ccff" -selectforeground black
.bloc1.modem.lchipset.contenu configure -exportselection 0
set i 0
set len [llength $chipsets]
while {$i<$len} {
.bloc1.modem.lchipset.contenu insert end [lindex $chipsets $i]
incr i
}
# previously defined chipset set?
if {"$chipset"!=""} {
set selected_chipset [expr [lsearch $chipsets $chipset]]
.bloc1.modem.lchipset.contenu selection set $selected_chipset
.bloc1.modem.lchipset.contenu see [.bloc1.modem.lchipset.contenu curselection]
} else {
set selected_provider -1
}
pack .bloc1.modem.lchipset.label .bloc1.modem.lchipset.contenu -side left
frame .bloc1.modem.vp
frame .bloc1.modem.vp.vidpid1
label .bloc1.modem.vp.vidpid1.labelvid -text "VID 1: " -width 6
entry .bloc1.modem.vp.vidpid1.entryvid -textvariable vid1 -background lightblue -width 7
pack .bloc1.modem.vp.vidpid1.labelvid .bloc1.modem.vp.vidpid1.entryvid -side left
label .bloc1.modem.vp.vidpid1.labelpid -text "PID 1: " -width 6
entry .bloc1.modem.vp.vidpid1.entrypid -textvariable pid1 -background lightblue -width 7
pack .bloc1.modem.vp.vidpid1.labelpid .bloc1.modem.vp.vidpid1.entrypid -side left
pack .bloc1.modem.vp.vidpid1
frame .bloc1.modem.vp.vidpid2
label .bloc1.modem.vp.vidpid2.labelvid -text "VID 2: " -width 6
entry .bloc1.modem.vp.vidpid2.entryvid -textvariable vid2 -background lightblue -width 7
pack .bloc1.modem.vp.vidpid2.labelvid .bloc1.modem.vp.vidpid2.entryvid -side left
label .bloc1.modem.vp.vidpid2.labelpid -text "PID 2: " -width 6
entry .bloc1.modem.vp.vidpid2.entrypid -textvariable pid2 -background lightblue -width 7
pack .bloc1.modem.vp.vidpid2.labelpid .bloc1.modem.vp.vidpid2.entrypid -side left
pack .bloc1.modem.vp.vidpid2
#=== ALT IFACE Params ===
frame .bloc1.modem.alt
frame .bloc1.modem.alt.altsynch
label .bloc1.modem.alt.altsynch.label -text {ALT synch :} -width 11 -anchor e
entry .bloc1.modem.alt.altsynch.edit -textvariable altsynch -background lightblue -width 1
bind .bloc1.modem.alt.altsynch.edit <Enter> {pushstate "USB Alt Interface for SYNCH process (0-5)"}
bind .bloc1.modem.alt.altsynch.edit <Leave> {popstate}
pack .bloc1.modem.alt.altsynch.label .bloc1.modem.alt.altsynch.edit -side left
frame .bloc1.modem.alt.altpppoeci
label .bloc1.modem.alt.altpppoeci.label -text {ALT pppoeci:} -width 11 -anchor e
entry .bloc1.modem.alt.altpppoeci.edit -textvariable altpppoeci -background lightblue -width 1
bind .bloc1.modem.alt.altpppoeci.edit <Enter> {pushstate "USB Alt Interface for PPPOECI process (0-5)"}
bind .bloc1.modem.alt.altpppoeci.edit <Leave> {popstate}
pack .bloc1.modem.alt.altpppoeci.label .bloc1.modem.alt.altpppoeci.edit -side left
pack .bloc1.modem.alt.altsynch .bloc1.modem.alt.altpppoeci
pack .bloc1.modem.lchipset .bloc1.modem.vp .bloc1.modem.alt -side left
.bloc1.modem.liste.contenu configure -foreground black -selectbackground "#00ccff" -selectforeground black
.bloc1.modem.vp.vidpid1.entryvid configure -state normal -foreground darkgray -background lightgray
.bloc1.modem.vp.vidpid1.entrypid configure -state normal -foreground darkgray -background lightgray
.bloc1.modem.vp.vidpid2.entryvid configure -state normal -foreground darkgray -background lightgray
.bloc1.modem.vp.vidpid2.entrypid configure -state normal -foreground darkgray -background lightgray
.bloc1.modem.vp.vidpid1.labelvid configure -foreground darkgray
.bloc1.modem.vp.vidpid1.labelpid configure -foreground darkgray
.bloc1.modem.vp.vidpid2.labelvid configure -foreground darkgray
.bloc1.modem.vp.vidpid2.labelpid configure -foreground darkgray
bind .bloc1.modem.liste.contenu <ButtonRelease> {select_modem}
bind .bloc1.modem.liste.contenu <Enter> {pushstate "Select a modem"}
bind .bloc1.modem.liste.contenu <Leave> {popstate}
bind .bloc1.modem.lchipset.contenu <ButtonRelease> {select_chipset}
bind .bloc1.modem.vp.vidpid1 <Enter> {pushstate "These are the Vendor ID and Product ID of your modem (4-digit hexa)"}
bind .bloc1.modem.vp.vidpid1 <Leave> {popstate}
bind .bloc1.modem.vp.vidpid2 <Enter> {pushstate "These are the Vendor ID and Product ID of your modem once initialized (4-digit hexa)"}
bind .bloc1.modem.vp.vidpid2 <Leave> {popstate}
frame .bloc1.espace3 -width 15
pack .bloc1.espace1 .bloc1.fai .bloc1.espace2 .bloc1.modem .bloc1.espace3 -side left -anchor n
pack .bloc1
frame .ligne_vide2 -height 20
pack .ligne_vide2
#
# ===== synch .bin selection =====
#
frame .bloc2
frame .bloc2.listebin
checkbutton .bloc2.listebin.checkbox -text { Change synch .bin file (only if driver hangs up):} -command {invert_bin} -relief groove -background "#ffcc99" -width 45 -variable majbin -offvalue "non" -onvalue "oui" -selectcolor blue
bind .bloc2.listebin.checkbox <Enter> {pushstate "Check this box if you want to change your synch .bin file"}
bind .bloc2.listebin.checkbox <Leave> {popstate}
set majbin "non"
label .bloc2.listebin.actuel -text "Current .bin: $synch" -relief sunken -width 48 -anchor w
frame .bloc2.listebin.liste
listbox .bloc2.listebin.liste.contenu -yscrollcommand ".bloc2.listebin.liste.scroll set" -width 45 -height 4 -foreground darkgray -selectbackground lightgray -selectforeground darkgray
.bloc2.listebin.liste.contenu configure -exportselection 0
proc add_bins {chemin} {
global .bloc2.listebin chipset
.bloc2.listebin.liste.contenu delete 0 end
set returncode [catch {exec find $chemin -name "*.bin" } bin_trouves]
if {$returncode != 0} {
} else {
if {"$chipset"=="GS7470"} {
foreach bin $bin_trouves {
if {[regexp "gs7470" $bin] && ![regexp "firmware" $bin] && ![regexp "a.bin" $bin] && ![regexp "b.bin" $bin] && [lsearch -glob [.bloc2.listebin.liste.contenu get 0 end] $bin] == -1} {
.bloc2.listebin.liste.contenu insert end $bin
}
}
} else {
foreach bin $bin_trouves {
if {![regexp "gs7470" $bin] && ![regexp "firmware" $bin] && ![regexp "a.bin" $bin] && ![regexp "b.bin" $bin] && [lsearch -glob [.bloc2.listebin.liste.contenu get 0 end] $bin] == -1} {
.bloc2.listebin.liste.contenu insert end $bin
}
}
}
}
}
add_bins "$CONF_DIR"
.bloc2.listebin.liste.contenu selection set 0
set bin_choisi [.bloc2.listebin.liste.contenu curselection]
set bin_initial $bin_choisi
bind .bloc2.listebin.liste.contenu <Enter> {pushstate "Choose another .bin (ONLY if driver hangs up into eciadsl-synch or LCP timeouts !)"}
bind .bloc2.listebin.liste.contenu <Leave> {popstate}
scrollbar .bloc2.listebin.liste.scroll -command ".bloc2.listebin.liste.contenu yview"
pack .bloc2.listebin.liste.contenu .bloc2.listebin.liste.scroll -side left -fill y
frame .bloc2.listebin.recherche
label .bloc2.listebin.recherche.texte -text {Search .bin here:} -width 15
set chemin_bin $CONF_DIR
entry .bloc2.listebin.recherche.chemin -textvariable chemin_bin -background "#CCEEEE" -width 27
bind .bloc2.listebin.recherche.chemin <Enter> {pushstate "Enter path for searching .bin files"}
bind .bloc2.listebin.recherche.chemin <Leave> {popstate}
image create bitmap bitmaptest -data "\
#define loupe_width 25 \
#define loupe_height 15 \
static unsigned char loupe_bits[] = { \
0x00, 0xe0, 0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x08, 0x04, 0x00, \
0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x08, 0x00, \
0x00, 0x04, 0x08, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x1c, 0x02, 0x00, \
0x00, 0xee, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, \
0xc0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 };"
button .bloc2.listebin.recherche.search -image bitmaptest -background "#99CCCC" -command {add_bins $chemin_bin}
bind .bloc2.listebin.recherche.search <Enter> {pushstate "Click to search .bin files (warning: can take a moment!)"}
bind .bloc2.listebin.recherche.search <Leave> {popstate}
pack .bloc2.listebin.recherche.texte .bloc2.listebin.recherche.chemin .bloc2.listebin.recherche.search -side left
pack .bloc2.listebin.checkbox
pack .bloc2.listebin.actuel
pack .bloc2.listebin.liste
pack .bloc2.listebin.recherche
pack .bloc2.listebin -padx 15
frame .bloc2.espace1 -width 5
#
# ===== PPP mode selection and advanced settings =====
#
frame .bloc2.modes
label .bloc2.modes.libelle -text "Select a PPP mode:" -relief groove -background "#ffcc99" -width 43
pack .bloc2.modes.libelle
list modes
set tmpfile "/tmp/eciadsl-config-tk.tmp"
catch {exec $BIN_DIR/eciadsl-pppoeci --modes >& "$tmpfile"}
set file [open "$tmpfile" r]
fconfigure $file -buffering line
while {[eof $file]!=1} {
set line [string trim [gets $file]]
if {"$line"!=""} {
set pos1 0
set pos2 [string first " " "$line" [expr $pos1+1]]
if {$pos2!=-1} {
# skip trailing blanks
set pos2 [expr $pos2-1]
} else {
set pos2 end
}
lappend modes [string trim [string range "$line" $pos1 $pos2]]
}
}
close $file
catch {exec rm -f "$tmpfile"}
frame .bloc2.modes.liste
listbox .bloc2.modes.liste.contenu -yscrollcommand {.bloc2.modes.liste.scroll set} -width 40 -height 4 -foreground black -selectbackground "#00ccff" -selectforeground black
.bloc2.modes.liste.contenu configure -exportselection 0
set i 0
set len [llength $modes]
while {$i<$len} {
.bloc2.modes.liste.contenu insert end [lindex $modes $i]
incr i
}
set selected_mode [lsearch $modes $mode]
if {$selected_mode==-1} {
set selected_mode 0
}
.bloc2.modes.liste.contenu selection set $selected_mode
.bloc2.modes.liste.contenu see [.bloc2.modes.liste.contenu curselection]
scrollbar .bloc2.modes.liste.scroll -command ".bloc2.modes.liste.contenu yview"
pack .bloc2.modes.liste.contenu .bloc2.modes.liste.scroll -side left -fill y
frame .bloc2.modes.espacevertic -height 5
pack .bloc2.modes.espacevertic
frame .bloc2.modes.advanced
checkbutton .bloc2.modes.advanced.use_dhcp -text {Use DHCP} -command {onclick_use_dhcp} -variable use_dhcp -offvalue "no" -onvalue "yes"
checkbutton .bloc2.modes.advanced.use_staticip -text {Use static IP} -command {onclick_use_staticip} -variable use_staticip -offvalue "no" -onvalue "yes"
pack .bloc2.modes.advanced.use_dhcp .bloc2.modes.advanced.use_staticip -side left
frame .bloc2.modes.staticip
label .bloc2.modes.staticip.label -text "IP: " -width 10
entry .bloc2.modes.staticip.edit -textvariable staticip -background lightblue -width 15
pack .bloc2.modes.staticip.label .bloc2.modes.staticip.edit -side left
frame .bloc2.modes.gateway
label .bloc2.modes.gateway.label -text "Gateway: " -width 10
entry .bloc2.modes.gateway.edit -textvariable gateway -background lightblue -width 15
pack .bloc2.modes.gateway.label .bloc2.modes.gateway.edit -side left
proc onclick_use_staticip {} {
global .bloc2.modes.staticip.edit .bloc2.modes.gateway.edit
global .bloc2.modes.staticip.label .bloc2.modes.gateway.label
global use_staticip use_dhcp
if {"$use_staticip"=="yes"} {
set use_dhcp "no"
.bloc2.modes.staticip.edit configure -state normal -foreground black -background lightblue
.bloc2.modes.gateway.edit configure -state normal -foreground black -background lightblue
.bloc2.modes.staticip.label configure -foreground black
.bloc2.modes.gateway.label configure -foreground black
focus .bloc2.modes.staticip.edit
} else {
.bloc2.modes.staticip.edit configure -state disabled -background lightgray
.bloc2.modes.gateway.edit configure -state disabled -background lightgray
.bloc2.modes.staticip.label configure -foreground darkgray
.bloc2.modes.gateway.label configure -foreground darkgray
}
}
proc onclick_use_dhcp {} {
global use_staticip use_dhcp
if {"$use_dhcp"=="yes"} {
set use_staticip "no"
onclick_use_staticip
}
}
onclick_use_dhcp
onclick_use_staticip
bind .bloc2.modes.liste.contenu <ButtonRelease> {select_mode}
bind .bloc2.modes.liste.contenu <Enter> {pushstate "Select a PPP mode/encapsulation (leave the first one selected if you don't know what it means)"}
bind .bloc2.modes.liste.contenu <Leave> {popstate}
bind .bloc2.modes.advanced.use_dhcp <Enter> {pushstate "Click here if you use DHCP to get an IP from your provider (MOST users should DISABLE this)"}
bind .bloc2.modes.advanced.use_dhcp <Leave> {popstate}
bind .bloc2.modes.advanced.use_staticip <Enter> {pushstate "Click here if you get a static IP from your provider (MOST users should DISABLE this)"}
bind .bloc2.modes.advanced.use_staticip <Leave> {popstate}
bind .bloc2.modes.staticip.edit <Enter> {pushstate "Your static IP (ONLY IF given by your provider)"}
bind .bloc2.modes.staticip.edit <Leave> {popstate}
bind .bloc2.modes.gateway.edit <Enter> {pushstate "Your provider's gateway IP (ONLY IF given by your provider)"}
bind .bloc2.modes.gateway.edit <Leave> {popstate}
pack .bloc2.modes.liste
pack .bloc2.modes.advanced .bloc2.modes.staticip .bloc2.modes.gateway
frame .bloc2.espace2 -width 15
pack .bloc2.listebin .bloc2.espace1 .bloc2.modes .bloc2.espace2 -side left -anchor n
pack .bloc2
frame .ligne_vide3 -height 15
pack .ligne_vide3
#
# ===== buttons =====
#
frame .boutons
button .boutons.create -text {Create config !} -width 15 -height 1 -command {run_makeconfig} -state disabled -background lightgray
bind .boutons.create <Enter> {pushstate "Save modifications then quit: select a modem first"}
bind .boutons.create <Leave> {popstate}
proc enable_create_button {} {
global .boutons.create
.boutons.create configure -state normal -background lightgreen
bind .boutons.create <Enter> {pushstate "Save settings: write configuration files and set synch .bin if enabled, then quit"}
bind .boutons.create <Leave> {popstate}
}
proc enable_vid_pid {} {
global .bloc1.modem.vp.vidpid1.entryvid .bloc1.modem.vp.vidpid1.entrypid
global .bloc1.modem.vp.vidpid2.entryvid .bloc1.modem.vp.vidpid2.entrypid
global .bloc1.modem.vp.vidpid1.labelvid .bloc1.modem.vp.vidpid1.labelpid
global .bloc1.modem.vp.vidpid2.labelvid .bloc1.modem.vp.vidpid2.labelpid
.bloc1.modem.vp.vidpid1.entryvid configure -state normal -foreground black -background lightblue
.bloc1.modem.vp.vidpid1.entrypid configure -state normal -foreground black -background lightblue
.bloc1.modem.vp.vidpid2.entryvid configure -state normal -foreground black -background lightblue
.bloc1.modem.vp.vidpid2.entrypid configure -state normal -foreground black -background lightblue
.bloc1.modem.vp.vidpid1.labelvid configure -foreground black
.bloc1.modem.vp.vidpid1.labelpid configure -foreground black
.bloc1.modem.vp.vidpid2.labelvid configure -foreground black
.bloc1.modem.vp.vidpid2.labelpid configure -foreground black
}
# if all VID/PID are already set, enable the CREATE button
if {"$modem"!="" && "$vid1"!="" && "$pid1"!="" && "$vid2"!="" && "$pid2"!=""} {
enable_vid_pid
enable_create_button
}
frame .boutons.espace -width 20
button .boutons.dabusb -text {Remove Dabusb} -background "#ffccff" -command {run_dabusb} -padx 10
bind .boutons.dabusb <Enter> {pushstate "Unplug your modem first and then click on this button to remove dabusb"}
bind .boutons.dabusb <Leave> {popstate}
frame .boutons.espace1 -width 20
button .boutons.set_bin -text {Change synch .bin} -width 15 -height 1 -command {run_makeconfig_synch} -state disabled -background lightgray
bind .boutons.set_bin <Enter> {pushstate "Only change current synch .bin: enable it above and select a .bin"}
bind .boutons.set_bin <Leave> {popstate}
frame .boutons.espace2 -width 20
button .boutons.cancel -text {Cancel} -background "#ffbbbb" -width 15 -height 1 -command {exit}
bind .boutons.cancel <Enter> {pushstate "Quit without saving"}
bind .boutons.cancel <Leave> {popstate}
pack .boutons.create .boutons.espace .boutons.dabusb .boutons.espace1 .boutons.set_bin .boutons.espace2 .boutons.cancel -side left
pack .boutons
frame .ligne_vide4 -height 15
pack .ligne_vide4
label .state -textvariable statetext -borderwidth 2 -relief sunken -anchor w
pack .state -fill x
set statetext "Ready."
proc conf_report {exit msg color sortie} {
global titre_fenetre
if {"$exit"=="oui"} {
catch {destroy .confok}
}
toplevel .confok
wm title .confok $titre_fenetre
message .confok.texte -text "$msg" -aspect 600 -padx 15 -pady 15
if {"$sortie"!=""} {
message .confok.sortie -text "$sortie" -aspect 600 -padx 15 -pady 15 -background $color
} else {
message .confok.sortie
}
if {"$exit"=="oui"} {
button .confok.ok -text { Quit } -command {exit}
} else {
button .confok.ok -text { Close } -command {destroy .confok}
}
pack .confok.texte .confok.sortie .confok.ok -side top
pack configure .confok.ok -pady 15
grab set .confok
tkwait window .confok
}
#
# ===== calls to eciadsl-makeconfig =====
#
proc run_makeconfig_synch {} {
global BIN_DIR majbin
if {[string compare $majbin "oui"] == 0} {
set numero_bin_choix [.bloc2.listebin.liste.contenu curselection]
set synch [.bloc2.listebin.liste.contenu get $numero_bin_choix]
set returncode [catch {exec $BIN_DIR/eciadsl-makeconfig --synch "$synch"} sortie]
if {$returncode != 0} {
conf_report "non" "Synch .bin has NOT been set.\n\nThis is the error from makeconfig:" "#ffbbbb" $sortie
} else {
conf_report "non" "Synch .bin has been changed and will\nbe used the next time you run eciadsl-start." lightgreen ""
}
}
}
proc run_makeconfig {} {
global majfai majbin BIN_DIR synch firm
global mode use_staticip use_dhcp staticip gateway modem provider
global username password dns1 dns2 vpi vci vid1 pid1 vid2 pid2 chipset altsynch altpppoeci
if {[string compare $majbin "oui"] == 0} {
set synch [.bloc2.listebin.liste.contenu get [.bloc2.listebin.liste.contenu curselection]]
}
set returncode [catch {exec $BIN_DIR/eciadsl-makeconfig "$mode" "$username" "$password" "$BIN_DIR/eciadsl-pppoeci" "$dns1" "$dns2" $vpi $vci "$vid1$pid1" "$vid2$pid2" "$synch" "$firm" "$staticip" "$gateway" "$use_staticip" "$use_dhcp" "$modem" "$provider" "$chipset" "$altsynch" "$altpppoeci"} sortie]
if {$returncode != 0} {
conf_report "non" "eciadsl-makeconfig did not update your files.\n\nThis is the error:" "#ffbbbb" $sortie
} else {
conf_report "oui" "Configuration files updated with success!\n\nThis is eciadsl-makeconfig output:" lightgreen $sortie
}
}
#
# ===== call to eciadsl-remove-dabusb =====
#
proc run_dabusb {} {
global BIN_DIR
set returncode [catch {exec $BIN_DIR/eciadsl-remove-dabusb} sortie]
toplevel .dab
wm title .dab "dabusb"
if {$returncode != 0} {
set msg "Dabusb couldn't be removed...\n\nThe error is:"
set vmtitle "Error"
set color "#ffbbbb"
} else {
set msg "Dabusb succesfully removed.\n\nThis is eciadsl-remove-dabusb output:"
set vmtitle "OK"
set color lightgreen
}
message .dab.texte -text "$msg" -aspect 600 -padx 15 -pady 15
message .dab.sortie -text "$sortie" -aspect 600 -padx 15 -pady 15 -background $color
button .dab.ok -text { O K } -command {destroy .dab}
pack .dab.texte .dab.sortie .dab.ok -side top
pack configure .dab.ok -pady 15
grab set .dab
tkwait window .dab
}
#
# ===== display field help =====
#
proc pushstate {msg} {
global statetext statepile topstatepile
if {[info exists topstatepile] == 0} {
set topstatepile 0
}
incr topstatepile 1
set statepile{$topstatepile} $msg
set statetext $msg
}
proc popstate {} {
global statetext statepile topstatepile
if {[info exists topstatepile] != 0} {
if {$topstatepile > 1} {
unset statepile($topstatepile)
incr topstatepile -1
set statetext $statepile($topstatepile)
} else {
set topstatepile 0
set statetext "Ready."
}
}
}
#
# ===== invert provider state (enabled/disabled) =====
#
proc invert_fai {} {
global majfai fai_choisi providers
if {"$majfai"=="oui"} {
.bloc1.fai.liste.contenu configure -foreground black -selectbackground "#00ccff" -selectforeground black
if {$fai_choisi!=""} {
.bloc1.fai.dns1.entry configure -state normal -foreground black -background lightblue
.bloc1.fai.dns2.entry configure -state normal -foreground black -background lightblue
.bloc1.fai.dns1.label configure -foreground black
.bloc1.fai.dns2.label configure -foreground black
.bloc1.fai.liste.contenu selection clear 0 [expr [llength $providers]-1]
.bloc1.fai.liste.contenu selection set $fai_choisi
} else {
if {[.bloc1.fai.liste.contenu curselection]==""} {
.bloc1.fai.liste.contenu selection set 0
}
}
select_provider
} else {
set fai_choisi [.bloc1.fai.liste.contenu curselection]
.bloc1.fai.liste.contenu configure -foreground darkgray -selectbackground lightgray -selectforeground darkgray
.bloc1.fai.dns1.entry configure -state disabled -foreground darkgray -background lightgray
.bloc1.fai.dns2.entry configure -state disabled -foreground darkgray -background lightgray
.bloc1.fai.dns1.label configure -foreground darkgray
.bloc1.fai.dns2.label configure -foreground darkgray
}
}
#
# ===== invert .bin files (enabled/disabled) =====
#
proc invert_bin {} {
global majbin bin_choisi bin_initial chemin_bin
global .boutons.set_bin
if {[string compare $majbin "oui"] == 0} {
add_bins $chemin_bin
if {[.bloc2.listebin.liste.contenu size] > 0} {
if {[string compare $bin_choisi ""] == 0} {
.bloc2.listebin.liste.contenu selection set 0
set bin_choisi [.bloc2.listebin.liste.contenu curselection]
}
.bloc2.listebin.liste.contenu configure -foreground black -selectbackground "#00ccff" -selectforeground black
.bloc2.listebin.liste.contenu selection clear 0 end
.bloc2.listebin.liste.contenu selection set $bin_choisi
.bloc2.listebin.liste.contenu see $bin_choisi
.boutons.set_bin configure -state normal -background lightblue
bind .boutons.set_bin <Enter> {pushstate "Only change current synch .bin with the selected one"}
bind .boutons.set_bin <Leave> {popstate}
} else {
set majbin "non"
}
} else {
.bloc2.listebin.liste.contenu configure -foreground darkgray -selectbackground lightgray -selectforeground darkgray
set bin_choisi [.bloc2.listebin.liste.contenu curselection]
if {[string compare $bin_choisi ""] == 0} {
set bin_choisi $bin_initial
}
.boutons.set_bin configure -state disabled -background lightgray
bind .boutons.set_bin <Enter> {pushstate "Only change current synch .bin: enable it above and select a .bin"}
bind .boutons.set_bin <Leave> {popstate}
}
}
proc select_chipset {} {
global .bloc1.modem.lchipset.contenu
global chipsets chipset altsynch altpppoeci
set index [.bloc1.modem.lchipset.contenu curselection]
if {"$index"!=""} {
# update variables from the selection
set chipset [.bloc1.modem.lchipset.contenu get $index]
if {"$chipset"!="GS7070"} {
set altsynch "5"
set altpppoeci "1"
} else {
set altsynch "4"
set altpppoeci "4"
}
# .bloc1.modem.alt.altsynch.edit delete 0 end
# .bloc1.modem.alt.altsynch.edit insert 0 $altsynch
# .bloc1.modem.alt.altpppoeci.edit delete 0 end
# .bloc1.modem.alt.altpppoeci.edit insert 0 $altpppoeci
}
}