forked from quic/quic-usb-drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQcDevDriver.sh
executable file
·1022 lines (892 loc) · 41 KB
/
QcDevDriver.sh
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
#!/bin/bash
# Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
DEST_QUIC_PATH=/opt/QUIC/
DEST_USB_PATH=/opt/QUIC/USB
DEST_INS_RMNET_PATH=/opt/QUIC/USB/rmnet
DEST_INS_QDSS_PATH=/opt/QUIC/USB/diag
DEST_INF_PATH=/opt/QUIC/USB/diag/InfParser
DEST_QDSS_DAIG_PATH=/opt/QUIC/USB/diag/QdssDiag
DEST_SIGN_PATH=/opt/QUIC/sign
QUIC_MODBIN_DIR=/sbin
QUIC_MAKE_DIR=/usr/bin
QUIC_MODULE_INF_NAME=qtiDevInf.ko
QUIC_MODULE_QDSS_DIAG_NAME=QdssDiag.ko
QUIC_MODULE_RMNET_NAME=GobiNet.ko
QUIC_DIAG_INF_PATH=/opt/QUIC/USB/diag/qtiser.inf
QUIC_QDSS_INF_PATH=/opt/QUIC/USB/diag/qdbusb.inf
QUIC_MODEM_INF_PATH=/opt/QUIC/USB/serial/qtimdm.inf
DEST_INS_SERIAL_PATH=/opt/QUIC/USB/serial
QUIC_UDEV_PATH=/etc/udev/rules.d
QUIC_MODULE_GOBISERIAL_NAME=GobiSerial.ko
QUIC_SERIAL=/lib/modules/`uname -r`/kernel/drivers/usb/serial
QUIC_QMI_WWAN=/lib/modules/`uname -r`/kernel/drivers/net/usb
QUIC_NET=/lib/modules/`uname -r`/kernel/drivers/net
QUIC_LN_RM_MK_DIR=/bin
MODULE_BLACKLIST=/etc/modprobe.d
OS_RELEASE="`cat /etc/os-release | grep PRETTY_NAME`"
OSName=`echo $OS_RELEASE | awk -F= '{printf $2}'`
KERNEL_VERSION=`uname -r`
#check and install mokutil package
if [ ! -f "$QUIC_MAKE_DIR/mokutil" ]; then
echo "Error: mokutil not found, installing..\n"
if [[ $OSName =~ "Red Hat Enterprise Linux" ]]; then
sudo dnf install -y mokutil
sudo dnf install -y keyutils
fi
if [[ $OSName =~ "Ubuntu" ]]; then
sudo apt-get install -y mokutil
sudo apt-get install -y keyutils
fi
fi
QUIC_SECURE_BOOT_CHECK=`mokutil --sb-state`
if [[ $QUIC_SECURE_BOOT_CHECK = "SecureBoot enabled" ]]; then
QUIC_PUBLIC_KEY_VERIFY=`mokutil --test-key $DEST_SIGN_PATH/Signkey_pub.der`
fi
if [ ! -d $DEST_USB_PATH ]; then
echo "Error: $DEST_USB_PATH doesn't exist. Creating Now."
$QUIC_LN_RM_MK_DIR/mkdir -m 0755 -p $DEST_USB_PATH
fi
if [ $# == 0 ]; then
echo "Usage: QUICDevInstaller.sh <install | uninstall>"
exit 1
else
if [ $1 == "uninstall" ]; then
echo "Operating System: $OSName"
echo "Kernel Version: "\""`uname -r`"\"""
if [ -d $DEST_INS_QDSS_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
if [ ! -d $DEST_INS_QDSS_PATH ]; then
echo "Successfully removed $DEST_INS_QDSS_PATH"
else
echo "Failed to remove $DEST_INS_QDSS_PATH"
fi
else
echo "$DEST_INS_QDSS_PATH does not exist, nothing to remove"
fi
if [ -d $DEST_INS_RMNET_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
if [ ! -d $DEST_INS_RMNET_PATH ]; then
echo "Successfully removed $DEST_INS_RMNET_PATH"
else
echo "Failed to remove $DEST_INS_RMNET_PATH"
fi
else
echo "$DEST_INS_RMNET_PATH does not exist, nothing to remove"
fi
if [ -d $DEST_INS_SERIAL_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_SERIAL_PATH
if [ ! -d $DEST_INS_SERIAL_PATH ]; then
echo "Successfully removed $DEST_INS_SERIAL_PATH"
else
echo "Failed to remove $DEST_INS_SERIAL_PATH"
fi
else
echo "$DEST_INS_SERIAL_PATH does not exist, nothing to remove"
fi
if [ -f $QUIC_UDEV_PATH/qti_usb_device.rules ]; then
rm -r $QUIC_UDEV_PATH/qti_usb_device.rules
if [ ! -f $QUIC_UDEV_PATH/qti_usb_device.rules ]; then
echo "Successfully removed $QUIC_UDEV_PATH/qti_usb_device.rules"
else
echo "Failed to remove $QUIC_UDEV_PATH/qti_usb_device.rules"
fi
else
echo "$QUIC_UDEV_PATH/qti_usb_device.rules does not exist, nothing to remove"
fi
# < "Redundant 80-net-setup-link.rules. This code will be eliminated after few releases"
if [ -f $QUIC_UDEV_PATH/80-net-setup-link.rules ]; then
sed -i '/GobiQMI/d' $QUIC_UDEV_PATH/80-net-setup-link.rules
if [ ! -s $QUIC_UDEV_PATH/80-net-setup-link.rules ]; then
echo "Removed GobiQMI rule from $QUIC_UDEV_PATH/80-net-setup-link.rules"
rm -rf $QUIC_UDEV_PATH/80-net-setup-link.rules
if [ ! -f $QUIC_UDEV_PATH/80-net-setup-link.rules ]; then
echo "File was empty. Removed $QUIC_UDEV_PATH/80-net-setup-link.rules successfully"
else
echo "File is empty but Failed to remove $QUIC_UDEV_PATH/80-net-setup-link.rules"
fi
else
echo "Pre-Existing data $QUIC_UDEV_PATH/80-net-setup-link.rules, so not removing it."
fi
else
echo "$QUIC_UDEV_PATH/80-net-setup-link.rules does not exist, nothing to remove"
fi
# >
if [ -f $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules ]; then
sed -i '/usb/d' $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules
if [ ! -s $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules ]; then
echo "Removed GobiQMI rule from $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules"
rm -rf $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules
if [ ! -f $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules ]; then
echo "File was empty. Removed $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules successfully"
else
echo "File is empty but Failed to remove $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules"
fi
else
echo "Pre-Existing data $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules, so not removing it."
fi
else
echo "$QUIC_UDEV_PATH/80-gobinet-usbdevice.rules does not exist, nothing to remove"
fi
# Informs udev deamon to reload the newly added device rule and re-trigger service
sudo udevadm control --reload-rules
sudo udevadm trigger
if [ "`lsmod | grep GobiSerial`" ]; then
($QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_GOBISERIAL_NAME && echo "$QUIC_MODULE_GOBISERIAL_NAME removed successfully") || { echo "$QUIC_MODULE_GOBISERIAL_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
else
echo "Module $QUIC_MODULE_GOBISERIAL_NAME is not currently loaded"
fi
if [ "`lsmod | grep GobiNet`" ]; then
( $QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_RMNET_NAME && echo "$QUIC_MODULE_RMNET_NAME removed successfully" ) || { echo "$QUIC_MODULE_RMNET_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
else
echo "Module $QUIC_MODULE_RMNET_NAME is not currently loaded"
fi
if [ "`lsmod | grep QdssDiag`" ]; then
($QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_QDSS_DIAG_NAME && echo "$QUIC_MODULE_QDSS_DIAG_NAME removed successfully") || { echo "$QUIC_MODULE_QDSS_DIAG_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
else
echo "Module $QUIC_MODULE_QDSS_DIAG_NAME is not currently loaded"
fi
if [ "`lsmod | grep qtiDevInf`" ]; then
($QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_INF_NAME && echo "$QUIC_MODULE_INF_NAME removed successfully") || { echo "$QUIC_MODULE_INF_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
else
echo "Module $QUIC_MODULE_INF_NAME is not currently loaded"
fi
MODLOADED="`/sbin/lsmod | grep usb_wwan`"
if [ "$MODLOADED" != "" ]; then
echo "usb_wwan module is already loaded. nothing to do"
elif [ -f $QUIC_SERIAL/usb_wwan_dup.ko ]; then
echo "usb_wwan_dup is found. restoring to usb_wwan"
mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/usb_wwan_dup.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/usb_wwan.ko
$QUIC_MODBIN_DIR/insmod /lib/modules/`uname -r`/kernel/drivers/usb/serial/usb_wwan.ko
MODLOADED="`/sbin/lsmod | grep usb_wwan`"
if [ "$MODLOADED" != "" ]; then
echo "Successfully loaded usb_wwan module."
fi
fi
MODLOADED="`/sbin/lsmod | grep qcserial`"
if [ "$MODLOADED" != "" ]; then
echo "qcserial module is already loaded. nothing to do"
elif [ -f $QUIC_SERIAL/qcserial_dup.ko ]; then
echo "qcserial_dup is found. restoring to qcserial"
mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/qcserial_dup.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/qcserial.ko
$QUIC_MODBIN_DIR/insmod /lib/modules/`uname -r`/kernel/drivers/usb/serial/qcserial.ko
MODLOADED="`/sbin/lsmod | grep qcserial`"
if [ "$MODLOADED" != "" ]; then
echo "Successfully loaded qcserial module."
fi
fi
MODLOADED="`/sbin/lsmod | grep option`"
if [ "$MODLOADED" != "" ]; then
echo "option module is already loaded. nothing to do"
elif [ -f $QUIC_SERIAL/option_dup.ko ]; then
echo "option_dup is found. restoring to option"
mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/option_dup.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/option.ko
$QUIC_MODBIN_DIR/insmod /lib/modules/`uname -r`/kernel/drivers/usb/serial/option.ko
MODLOADED="`/sbin/lsmod | grep option`"
if [ "$MODLOADED" != "" ]; then
echo "Successfully loaded option module."
fi
fi
MODLOADED="`/sbin/lsmod | grep qmi_wwan`"
if [ "$MODLOADED" != "" ]; then
echo "qmi_wwan module is already loaded. nothing to do"
elif [ -f $QUIC_QMI_WWAN/qmi_wwan_dup.ko ]; then
echo "qmi_wwan_dup is found. restoring to qmi_wwan"
mv /lib/modules/`uname -r`/kernel/drivers/usb/class/cdc-wdm_dup.ko /lib/modules/`uname -r`/kernel/drivers/usb/class/cdc-wdm.ko
mv /lib/modules/`uname -r`/kernel/drivers/net/usb/qmi_wwan_dup.ko /lib/modules/`uname -r`/kernel/drivers/net/usb/qmi_wwan.ko
$QUIC_MODBIN_DIR/insmod /lib/modules/`uname -r`/kernel/drivers/usb/class/cdc-wdm.ko
$QUIC_MODBIN_DIR/insmod /lib/modules/`uname -r`/kernel/drivers/net/usb/qmi_wwan.ko
MODLOADED="`/sbin/lsmod | grep qmi_wwan`"
if [ "$MODLOADED" != "" ]; then
echo "Successfully loaded qmi_wwan module."
fi
fi
if [ "`grep -nr 'Qualcomm clients' /etc/modprobe.d/blacklist.conf`" != "" ]; then
sed -i '/# Blacklist these module so that Qualcomm clients use only/d' /etc/modprobe.d/blacklist.conf
sed -i '/# GobiNet, GobiSerial, QdssDiag, qtiDevInf driver/d' /etc/modprobe.d/blacklist.conf
fi
MOD_EXIST="`grep -nr 'blacklist qcserial' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/qcserial/d' $MODULE_BLACKLIST/blacklist.conf
echo "Successfully removed qcserial from $MODULE_BLACKLIST/blacklist.conf"
fi
MOD_EXIST="`grep -nr 'blacklist qmi_wwan' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/qmi_wwan/d' $MODULE_BLACKLIST/blacklist.conf
echo "Successfully removed qmi_wwan from $MODULE_BLACKLIST/blacklist.conf"
fi
MOD_EXIST="`grep -nr 'blacklist option' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/option/d' $MODULE_BLACKLIST/blacklist.conf
echo "Successfully removed option from $MODULE_BLACKLIST/blacklist.conf"
fi
MOD_EXIST="`grep -nr 'blacklist usb_wwan' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/usb_wwan/d' $MODULE_BLACKLIST/blacklist.conf
echo "Successfully removed usb_wwan from $MODULE_BLACKLIST/blacklist.conf"
fi
#change to permission to default mode
$QUIC_LN_RM_MK_DIR/chmod 644 $MODULE_BLACKLIST/blacklist.conf
echo "Removing modules for /etc/modules."
MODUPDATE="`grep -r qtiDevInf /etc/modules`"
if [ "$MODUPDATE" == "qtiDevInf" ]; then
sed -i '/qtiDevInf/d' /etc/modules
fi
MODUPDATE="`grep -r QdssDiag /etc/modules`"
if [ "$MODUPDATE" == "QdssDiag" ]; then
sed -i '/QdssDiag/d' /etc/modules
fi
MODUPDATE="`grep -r GobiNet /etc/modules`"
if [ "$MODUPDATE" == "GobiNet" ]; then
sed -i '/GobiNet/d' /etc/modules
fi
MODUPDATE="`grep -r GobiSerial /etc/modules`"
if [ "$MODUPDATE" == "GobiSerial" ]; then
sed -i '/GobiSerial/d' /etc/modules
fi
if [[ $OSName != *"Red Hat Enterprise Linux"* ]]; then
MODUPDATE="`grep -nr 'iface usb0 inet static' /etc/network/interfaces`"
if [ "$MODUPDATE" != "" ]; then
sed -i '/iface usb0 inet static/d' /etc/network/interfaces
fi
fi
echo "Removing modules from $QUIC_SERIAL"
if [ -f $QUIC_SERIAL/$QUIC_MODULE_GOBISERIAL_NAME ]; then
rm -rf $QUIC_SERIAL/$QUIC_MODULE_GOBISERIAL_NAME
fi
echo "Removing modules from $QUIC_QMI_WWAN"
if [ -f $QUIC_QMI_WWAN/$QUIC_MODULE_QDSS_DIAG_NAME ]; then
rm -rf $QUIC_QMI_WWAN/$QUIC_MODULE_QDSS_DIAG_NAME
fi
if [ -f $QUIC_QMI_WWAN/$QUIC_MODULE_RMNET_NAME ]; then
rm -rf $QUIC_QMI_WWAN/$QUIC_MODULE_RMNET_NAME
fi
if [ -f $QUIC_QMI_WWAN/$QUIC_MODULE_INF_NAME ]; then
rm -rf $QUIC_QMI_WWAN/$QUIC_MODULE_INF_NAME
fi
depmod
# if [ -f $DEST_USB_PATH/ReleaseNotes*.txt ]; then
# $QUIC_LN_RM_MK_DIR/rm -rf $DEST_USB_PATH/ReleaseNotes*.txt
# fi
echo "Uninstallation completed successfully."
exit 0
else
if [ $1 != "install" ]; then
echo "Usage: QUICDevInstaller.sh <install | uninstall>"
exit 1
fi
fi
fi
######## Installation ###########
if [[ $OSName =~ "Ubuntu" ]]; then
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y gawk
sudo apt-get install -y python3-tk
fi
IFS=. read -r major_ver minor_ver patch_ver <<< "$KERNEL_VERSION"
if [[ $OSName =~ "Ubuntu 22." ]] && (( "$major_ver" >= 6 && "$minor_ver" >= 5 )); then
echo "Installing gcc 12 version ..."
sudo apt install -y gcc-12 g++-12
fi
echo "======================================================================================="
echo "======================================================================================="
echo " "
echo "Operating System: $OSName"
echo "Kernel Version: "\"$KERNEL_VERSION\"""
if [ -f ./version.h ]; then
VERSION="`grep -r '#define DRIVER_VERSION' version.h`"
DRIVER_VERSION=`echo $VERSION | awk '{printf $3}'`
echo "Driver Version: $DRIVER_VERSION"
fi
echo "Installing at the following paths:"
echo $DEST_INS_SERIAL_PATH
echo $DEST_INS_QDSS_PATH
echo $DEST_INS_RMNET_PATH
# this script will use in qik uninstallation process
if [ -f "$DEST_USB_PATH/QcDevDriver.sh" ]; then
echo "Delete and copy again (QcDevDriver.sh)"
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_USB_PATH/QcDevDriver.sh
$QUIC_LN_RM_MK_DIR/cp -rf ./QcDevDriver.sh $DEST_USB_PATH/
else
echo "Does not exist and copying now.. (QcDevDriver.sh)"
$QUIC_LN_RM_MK_DIR/cp -rf ./QcDevDriver.sh $DEST_USB_PATH/
fi
# Create directories
if [ -d $DEST_INS_SERIAL_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_SERIAL_PATH
fi
$QUIC_LN_RM_MK_DIR/mkdir -m 0755 -p $DEST_INS_SERIAL_PATH
if [ ! -d $DEST_INS_SERIAL_PATH ]; then
echo "Error: Failed to create installation path, please run installer under root."
exit 1
fi
if [ -d $DEST_INS_QDSS_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
fi
$QUIC_LN_RM_MK_DIR/mkdir -m 0755 -p $DEST_INS_QDSS_PATH
if [ ! -d $DEST_INS_QDSS_PATH ]; then
echo "Error: Failed to create installation path, please run installer under root."
exit 1
fi
if [ -d $DEST_INF_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INF_PATH
fi
$QUIC_LN_RM_MK_DIR/mkdir -m 0755 -p $DEST_INF_PATH
if [ ! -d $DEST_INF_PATH ]; then
echo "Error: Failed to create installation path, please run installer under root."
exit 1
fi
if [ -d $DEST_QDSS_DAIG_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_QDSS_DAIG_PATH
fi
$QUIC_LN_RM_MK_DIR/mkdir -m 0755 -p $DEST_QDSS_DAIG_PATH
if [ ! -d $DEST_QDSS_DAIG_PATH ]; then
echo "Error: Failed to create installation path, please run installer under root."
exit 1
fi
# Important: Do not delete or recreate the "sign" folder.
# The sign files will be automatically generated whenever the Signpub key is not enrolled.
$QUIC_LN_RM_MK_DIR/mkdir -m 0777 -p $DEST_SIGN_PATH
if [ ! -d $DEST_SIGN_PATH ]; then
echo "Error: Failed to create installation path, please run installer under root."
exit 1
fi
# $QUIC_LN_RM_MK_DIR/cp ./GobiSerial/GobiSerial.c $DEST_INS_SERIAL_PATH
# if [ ! -f $DEST_INS_SERIAL_PATH/GobiSerial.c ]; then
# echo "Error: Failed to copy GobiSerial.c to installation path, installation abort."
# rm -r $DEST_INS_SERIAL_PATH
# exit 1
# fi
# $QUIC_LN_RM_MK_DIR/cp ./GobiSerial/GobiSerial.h $DEST_INS_SERIAL_PATH
# if [ ! -f $DEST_INS_SERIAL_PATH/GobiSerial.h ]; then
# echo "Error: Failed to copy GobiSerial.h to installation path, installation abort."
# rm -r $DEST_INS_SERIAL_PATH
# exit 1
# fi
# $QUIC_LN_RM_MK_DIR/cp ./GobiSerial/Makefile $DEST_INS_SERIAL_PATH
# if [ ! -f $DEST_INS_SERIAL_PATH/Makefile ]; then
# echo "Error: Failed to copy Makefile installation path, installation abort."
# rm -r $DEST_INS_SERIAL_PATH
# exit 1
# fi
# $QUIC_LN_RM_MK_DIR/cp ./GobiSerial/qtidev.pl $DEST_INS_SERIAL_PATH
# if [ ! -f $DEST_INS_SERIAL_PATH/qtidev.pl ]; then
# echo "Error: Failed to copy qtidev.pl installation path, installation abort."
# rm -r $DEST_INS_SERIAL_PATH
# exit 1
# fi
# $QUIC_LN_RM_MK_DIR/chmod 755 $DEST_INS_SERIAL_PATH/qtidev.pl
$QUIC_LN_RM_MK_DIR/cp ./GobiSerial/qtiname.inf $DEST_INS_SERIAL_PATH
if [ ! -f $DEST_INS_SERIAL_PATH/qtiname.inf ]; then
echo "Error: Failed to copy qtiname.inf installation path, installation abort."
rm -r $DEST_INS_SERIAL_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_SERIAL_PATH/qtiname.inf
$QUIC_LN_RM_MK_DIR/cp ./GobiSerial/qtimdm.inf $DEST_INS_SERIAL_PATH
if [ ! -f $DEST_INS_SERIAL_PATH/qtimdm.inf ]; then
echo "Error: Failed to copy qtiname.inf installation path, installation abort."
rm -r $DEST_INS_SERIAL_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_SERIAL_PATH/qtimdm.inf
$QUIC_LN_RM_MK_DIR/cp ./GobiSerial/qtiname.inf $DEST_INS_QDSS_PATH/
if [ ! -f $DEST_INS_QDSS_PATH//qtiname.inf ]; then
echo "Error: Failed to copy qtiname.inf installation path, installation abort."
rm -r $DEST_INS_QDSS_PATH/
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_SERIAL_PATH/qtiname.inf
$QUIC_LN_RM_MK_DIR/cp ./GobiSerial/qtimdm.inf $DEST_INS_QDSS_PATH/
if [ ! -f $DEST_INS_QDSS_PATH//qtimdm.inf ]; then
echo "Error: Failed to copy qtiname.inf installation path, installation abort."
rm -r $DEST_INS_QDSS_PATH/
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_QDSS_PATH/qtimdm.inf
$QUIC_LN_RM_MK_DIR/cp ./QdssDiag/qdbusb.inf $DEST_INS_QDSS_PATH/
if [ ! -f $DEST_INS_QDSS_PATH/qdbusb.inf ]; then
echo "Error: Failed to copy 'qdbusb.inf' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./QdssDiag/qtiser.inf $DEST_INS_QDSS_PATH/
if [ ! -f $DEST_INS_QDSS_PATH/qtiser.inf ]; then
echo "Error: Failed to copy 'qtiser.inf' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_QDSS_PATH/qdbusb.inf
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_QDSS_PATH/qtiser.inf
$QUIC_LN_RM_MK_DIR/cp ./InfParser/qtiDevInf.h $DEST_INF_PATH/
if [ ! -f $DEST_INF_PATH/qtiDevInf.h ]; then
echo "Error: Failed to copy 'InfParser/qtiDevInf.h' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./InfParser/qtiDevInf.c $DEST_INF_PATH/
if [ ! -f $DEST_INF_PATH/qtiDevInf.c ]; then
echo "Error: Failed to copy 'InfParser/qtiDevInf.c' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./InfParser/Makefile $DEST_INF_PATH/
if [ ! -f $DEST_INF_PATH/Makefile ]; then
echo "Error: Failed to copy 'InfParser/Makefile' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./QdssDiag/qtiDevInf.h $DEST_QDSS_DAIG_PATH/
if [ ! -f $DEST_QDSS_DAIG_PATH/qtiDevInf.h ]; then
echo "Error: Failed to copy 'QdssDiag/qtiDevInf.h' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./QdssDiag/qtiDiag.h $DEST_QDSS_DAIG_PATH/
if [ ! -f $DEST_QDSS_DAIG_PATH/qtiDiag.h ]; then
echo "Error: Failed to copy 'QdssDiag/qtiDiag.h' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./QdssDiag/qtiDiag.c $DEST_QDSS_DAIG_PATH/
if [ ! -f $DEST_QDSS_DAIG_PATH/qtiDiag.c ]; then
echo "Error: Failed to copy 'QdssDiag/qtiDiag.c' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./Makefile $DEST_QDSS_DAIG_PATH/
if [ ! -f $DEST_QDSS_DAIG_PATH/Makefile ]; then
echo "Error: Failed to copy 'QdssDiag/Makefile' to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
exit 1
fi
if [ -d $DEST_INS_RMNET_PATH ]; then
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
fi
$QUIC_LN_RM_MK_DIR/mkdir -p $DEST_INS_RMNET_PATH
if [ ! -d $DEST_INS_RMNET_PATH ]; then
echo "Error: Failed to create installation path, please run installer under root."
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/IPAssignmentScript.sh $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/IPAssignmentScript.sh ]; then
echo "Error: Failed to copy IPAssignmentScript.sh to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 755 $DEST_INS_RMNET_PATH/IPAssignmentScript.sh
$QUIC_LN_RM_MK_DIR/cp ./rmnet/GobiUSBNet.c $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/GobiUSBNet.c ]; then
echo "Error: Failed to copy GobiUSBNet.c to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/QMIDevice.c $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/QMIDevice.c ]; then
echo "Error: Failed to copy QMIDevice.c to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/QMIDevice.h $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/QMIDevice.h ]; then
echo "Error: Failed to copy QMIDevice.h to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/QMI.c $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/QMI.c ]; then
echo "Error: Failed to copy QMI.c to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/QMI.h $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/QMI.h ]; then
echo "Error: Failed to copy QMI.h to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/qmap.c $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/qmap.c ]; then
echo "Error: Failed to copy qmap.c to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/qmap.h $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/qmap.h ]; then
echo "Error: Failed to copy qmap.h to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/Structs.h $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/Structs.h ]; then
echo "Error: Failed to copy Structs.h to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/Makefile $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/Makefile ]; then
echo "Error: Failed to copy Makefile installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/qtiwwan.inf $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/qtiwwan.inf ]; then
echo "Error: Failed to copy qtiwwan.inf installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_INS_RMNET_PATH/qtiwwan.inf
#DEST_SIGN_PATH=/opt/QUIC/sign/
$QUIC_LN_RM_MK_DIR/cp ./sign/SignConf.config $DEST_SIGN_PATH
$QUIC_LN_RM_MK_DIR/chmod 777 $DEST_SIGN_PATH/SignConf.config
awk -i inplace -v name=`hostname` '{gsub(/O = /,"O = "name)}1' $DEST_SIGN_PATH/SignConf.config
awk -i inplace -v name=`hostname` '{gsub(/CN = /,"CN = "name" Signing Key")}1' $DEST_SIGN_PATH/SignConf.config
awk -i inplace -v name=`hostname` '{gsub(/emailAddress = /,"emailAddress = "name"@no-reply.com")}1' $DEST_SIGN_PATH/SignConf.config
if [ ! -f $DEST_SIGN_PATH/SignConf.config ]; then
echo "Error: Failed to copy SignConf.config installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_SIGN_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./sign/signReadme.txt $DEST_SIGN_PATH
if [ ! -f $DEST_SIGN_PATH/signReadme.txt ]; then
echo "Error: Failed to copy signReadme.txt installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_SIGN_PATH
exit 1
fi
$QUIC_LN_RM_MK_DIR/chmod 644 $DEST_SIGN_PATH/signReadme.txt
if [[ $QUIC_SECURE_BOOT_CHECK = "SecureBoot enabled" ]]; then
echo "SecureBoot enabled"
if [ -f $DEST_SIGN_PATH/Signkey_pub.der ]; then
if [[ $QUIC_PUBLIC_KEY_VERIFY = "$DEST_SIGN_PATH/Signkey_pub.der is already enrolled" ]]; then
echo "==========================================================="
echo "$DEST_SIGN_PATH/Signkey_pub.der is enrolled"
echo "==========================================================="
else
echo "==========================================================="
echo "Secure Boot is enabled. User must enroll the Public Signkey located at /opt/QUIC/sign/Signkey_pub.der"
echo "Please follow the mandatory instructions in /opt/QUIC/sign/signReadme.txt"
echo "The USB driver installation Failed!!!"
echo "==========================================================="
exit 1
fi
else
echo "Signkey_pub.der doesn't exist. Creating public and private key"
openssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch -config $DEST_SIGN_PATH/SignConf.config -outform DER -out $DEST_SIGN_PATH/Signkey_pub.der -keyout $DEST_SIGN_PATH/Signkey.priv
$QUIC_LN_RM_MK_DIR/chmod 755 $DEST_SIGN_PATH/Signkey_pub.der
$QUIC_LN_RM_MK_DIR/chmod 755 $DEST_SIGN_PATH/Signkey.priv
echo "##############################################################"
echo "Secure Boot is enabled. User must enroll the Public Signkey located at /opt/QUIC/sign/Signkey_pub.der"
echo "Please follow the mandatory instructions in /opt/QUIC/sign/signReadme.txt"
echo "The USB driver installation Failed!!!"
echo "##############################################################"
exit 1
fi
else
echo "Secure boot disabled"
fi
# "********************* Compilation of modules Starts ***************************"
$QUIC_MAKE_DIR/make install
if [ ! -f ./InfParser/$QUIC_MODULE_INF_NAME ]; then
echo "Error: Failed to generate kernel module $QUIC_MODULE_INF_NAME, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
$QUIC_MAKE_DIR/make clean
exit 1
fi
if [ ! -f ./QdssDiag/$QUIC_MODULE_QDSS_DIAG_NAME ]; then
echo "Error: Failed to generate kernel module $QUIC_MODULE_QDSS_DIAG_NAME, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
$QUIC_MAKE_DIR/make clean
exit 1
fi
if [ ! -f ./rmnet/$QUIC_MODULE_RMNET_NAME ]; then
echo "Error: Failed to generate kernel module $QUIC_MODULE_RMNET_NAME, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
$QUIC_MAKE_DIR/make clean
exit 1
fi
# if [ ! -f ./GobiSerial/$QUIC_MODULE_GOBISERIAL_NAME ]; then
# echo "Error: Failed to generate kernel module $QUIC_MODULE_GOBISERIAL_NAME, installation abort."
# $QUIC_LN_RM_MK_DIR/rm -rf $QUIC_MODULE_GOBISERIAL_NAME
# $QUIC_MAKE_DIR/make clean
# exit 1
# fi
# Copy .ko object to destination folders
# $QUIC_LN_RM_MK_DIR/cp ./GobiSerial/$QUIC_MODULE_GOBISERIAL_NAME $DEST_INS_SERIAL_PATH
# if [ ! -f $DEST_INS_SERIAL_PATH/$QUIC_MODULE_GOBISERIAL_NAME ]; then
# echo "Error: Failed to copy $QUIC_MODULE_GOBISERIAL_NAME to installation path, installation abort."
# $QUIC_LN_RM_MK_DIR/rm -r $DEST_INS_SERIAL_PATH
# $QUIC_MAKE_DIR/make clean
# exit 1
# fi
$QUIC_LN_RM_MK_DIR/cp ./InfParser/$QUIC_MODULE_INF_NAME $DEST_INF_PATH
if [ ! -f $DEST_INF_PATH/$QUIC_MODULE_INF_NAME ]; then
echo "Error: Failed to copy $QUIC_MODULE_INF_NAME to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
$QUIC_MAKE_DIR/make clean
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./QdssDiag/$QUIC_MODULE_QDSS_DIAG_NAME $DEST_QDSS_DAIG_PATH
if [ ! -f $DEST_QDSS_DAIG_PATH/$QUIC_MODULE_QDSS_DIAG_NAME ]; then
echo "Error: Failed to copy $QUIC_MODULE_QDSS_DIAG_NAME to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_QDSS_PATH
$QUIC_MAKE_DIR/make clean
exit 1
fi
$QUIC_LN_RM_MK_DIR/cp ./rmnet/$QUIC_MODULE_RMNET_NAME $DEST_INS_RMNET_PATH
if [ ! -f $DEST_INS_RMNET_PATH/$QUIC_MODULE_RMNET_NAME ]; then
echo "Error: Failed to copy $QUIC_MODULE_RMNET_NAME to installation path, installation abort."
$QUIC_LN_RM_MK_DIR/rm -rf $DEST_INS_RMNET_PATH
exit 1
fi
$QUIC_MAKE_DIR/make clean
MODLOADED="`/sbin/lsmod | grep qtiDevInf`"
if [ "$MODLOADED" == "" ]; then
echo "To load dependency"
$QUIC_MODBIN_DIR/insmod $DEST_INF_PATH/$QUIC_MODULE_INF_NAME
echo "Loading module $QUIC_MODULE_INF_NAME"
else
echo "Module $QUIC_MODULE_INF_NAME already in place"
fi
# echo SUBSYSTEMS==\"tty\", PROGRAM=\"$DEST_INS_SERIAL_PATH/qtidev.pl $DEST_INS_SERIAL_PATH/qtiname.inf %k\", SYMLINK+=\"%c\" , MODE=\"0666\" > ./qti_usb_device.rules
echo SUBSYSTEMS==\"GobiQMI\", MODE=\"0666\" >> ./qti_usb_device.rules
echo SUBSYSTEMS==\"GobiUSB\", MODE=\"0666\" >> ./qti_usb_device.rules
echo SUBSYSTEMS==\"GobiPorts\", MODE=\"0666\" >> ./qti_usb_device.rules
$QUIC_LN_RM_MK_DIR/chmod 644 ./qti_usb_device.rules
$QUIC_LN_RM_MK_DIR/cp ./qti_usb_device.rules $QUIC_UDEV_PATH
echo "Generated QUIC rules"
# udev rules for QMI
if [ -f $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules ]; then
RULE_EXIST="`grep -nr 'usb' $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules`"
if [ "$RULE_EXIST" != "" ]; then
echo "Subsystem GobiQMI rule already exist in $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules, nothing to add"
else
echo "Subsystem GobiQMI rule doesn't exist in $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules, so adding now"
$QUIC_LN_RM_MK_DIR/chmod 644 $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules
echo SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"05c6\", NAME=\"usb%n\" >> $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules
fi
else
echo SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"05c6\", NAME=\"usb%n\" >> ./80-gobinet-usbdevice.rules
$QUIC_LN_RM_MK_DIR/chmod 644 ./80-gobinet-usbdevice.rules
$QUIC_LN_RM_MK_DIR/cp ./80-gobinet-usbdevice.rules $QUIC_UDEV_PATH
echo "Creating new udev rule for GobiQMI in $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules"
fi
# Informs udev deamon to reload the newly added device rule and re-trigger service
sudo udevadm control --reload-rules
sudo udevadm trigger
if [ ! -f $QUIC_UDEV_PATH/qti_usb_device.rules ]; then
echo "Error: Failed to generate $QUIC_UDEV_PATH/qti_usb_device.rules"
exit 1
fi
if [ ! -f $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules ]; then
echo "Error: Failed to generate $QUIC_UDEV_PATH/80-gobinet-usbdevice.rules"
exit 1
fi
rm -f ./qti_usb_device.rules
rm -f ./80-net-setup-link.rules
rm -f ./80-gobinet-usbdevice.rules
echo "Removed local rules"
MODLOADED="`/sbin/lsmod | grep usbserial`"
if [ "$MODLOADED" == "" ]; then
echo "To load dependency"
echo "Loading module usbserial"
if [[ $OSName =~ "Red Hat Enterprise Linux" ]]; then
if [ -f $QUIC_SERIAL/usbserial.ko.xz ]; then
xz -d $QUIC_SERIAL/usbserial.ko.xz
$QUIC_MODBIN_DIR/insmod $QUIC_SERIAL/usbserial.ko
fi
MODLOADED="`/sbin/lsmod | grep usbserial`"
if [ "$MODLOADED" == "" ]; then
echo "$OSName: usbserial.ko module not present at $QUIC_SERIAL"
fi
else
$QUIC_MODBIN_DIR/insmod $QUIC_SERIAL/usbserial.ko
fi
else
echo "Module usbserial already in place"
fi
#echo Changing Permission of blacklist file
$QUIC_LN_RM_MK_DIR/chmod 777 $MODULE_BLACKLIST/blacklist.conf
echo "Changed Permission of blacklist file"
if [ "`grep -nr 'Qualcomm clients' /etc/modprobe.d/blacklist.conf`" != "" ]; then
sed -i '/# Blacklist these module so that Qualcomm clients use only/d' /etc/modprobe.d/blacklist.conf
sed -i '/# GobiNet, GobiSerial, QdssDiag, qtiDevInf driver/d' /etc/modprobe.d/blacklist.conf
fi
echo "# Blacklist these module so that Qualcomm clients use only" >> /etc/modprobe.d/blacklist.conf
echo "# GobiNet, GobiSerial, QdssDiag, qtiDevInf driver" >> /etc/modprobe.d/blacklist.conf
MOD_EXIST="`grep -nr 'blacklist qcserial' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/qcserial/d' $MODULE_BLACKLIST/blacklist.conf
fi
echo "blacklist qcserial" >> /etc/modprobe.d/blacklist.conf
echo "install qcserial /bin/false" >> /etc/modprobe.d/blacklist.conf
echo "blacklisted qcserial module"
MODLOADED="`/sbin/lsmod | grep qcserial`"
if [ "$MODLOADED" != "" ]; then
$QUIC_MODBIN_DIR/rmmod qcserial.ko
MODLOADED="`/sbin/lsmod | grep qcserial`"
if [ "$MODLOADED" != "" ]; then
echo "Failed to unload qcserial.ko. Run manually sudo rmmod ModuleName"
fi
fi
if [ -f $QUIC_SERIAL/qcserial.ko ]; then
echo "qcserial is found. Unloaded module and moved to qcserial_dup.ko"
mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/qcserial.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/qcserial_dup.ko
fi
MOD_EXIST="`grep -nr 'blacklist qmi_wwan' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/qmi_wwan/d' $MODULE_BLACKLIST/blacklist.conf
fi
echo "blacklist qmi_wwan" >> /etc/modprobe.d/blacklist.conf
echo "install qmi_wwan /bin/false" >> /etc/modprobe.d/blacklist.conf
echo "blacklisted qmi_wwan module"
MODLOADED="`/sbin/lsmod | grep qmi_wwan`"
if [ "$MODLOADED" != "" ]; then
$QUIC_MODBIN_DIR/rmmod qmi_wwan.ko
$QUIC_MODBIN_DIR/rmmod cdc-wdm.ko
MODLOADED="`/sbin/lsmod | grep qmi_wwan`"
if [ "$MODLOADED" != "" ]; then
echo "Failed to unload qmi_wwan.ko. Run manually sudo rmmod ModuleName"
fi
fi
if [ -f $QUIC_QMI_WWAN/qmi_wwan.ko ]; then
echo "qmi_wwan is found. Unloaded module and moved to qmi_wwan_dup.ko"
mv /lib/modules/`uname -r`/kernel/drivers/usb/class/cdc-wdm.ko /lib/modules/`uname -r`/kernel/drivers/usb/class/cdc-wdm_dup.ko
mv /lib/modules/`uname -r`/kernel/drivers/net/usb/qmi_wwan.ko /lib/modules/`uname -r`/kernel/drivers/net/usb/qmi_wwan_dup.ko
fi
MOD_EXIST="`grep -nr 'blacklist option' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/option/d' $MODULE_BLACKLIST/blacklist.conf
fi
echo "blacklist option" >> /etc/modprobe.d/blacklist.conf
echo "install option /bin/false" >> /etc/modprobe.d/blacklist.conf
echo "blacklisted option module"
MODLOADED="`/sbin/lsmod | grep option`"
if [ "$MODLOADED" != "" ]; then
$QUIC_MODBIN_DIR/rmmod option.ko
MODLOADED="`/sbin/lsmod | grep option`"
if [ "$MODLOADED" != "" ]; then
echo "Failed to unload option.ko. Run manually sudo rmmod ModuleName"
fi
fi
if [ -f $QUIC_SERIAL/option.ko ]; then
echo "option is found. Unloaded module and moved to option_dup.ko"
mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/option.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/option_dup.ko
fi
MOD_EXIST="`grep -nr 'blacklist usb_wwan' /etc/modprobe.d/blacklist.conf`"
if [ "$MOD_EXIST" != "" ]; then
sed -i '/usb_wwan/d' $MODULE_BLACKLIST/blacklist.conf
fi
echo "blacklist usb_wwan" >> /etc/modprobe.d/blacklist.conf
echo "install usb_wwan /bin/false" >> /etc/modprobe.d/blacklist.conf
echo "blacklisted usb_wwan module"
MODLOADED="`/sbin/lsmod | grep usb_wwan`"
if [ "$MODLOADED" != "" ]; then
$QUIC_MODBIN_DIR/rmmod usb_wwan.ko
MODLOADED="`/sbin/lsmod | grep usb_wwan`"
if [ "$MODLOADED" != "" ]; then
echo "Failed to unload usb_wwan.ko. Run manually sudo rmmod ModuleName"
fi
fi
if [ -f $QUIC_SERIAL/usb_wwan.ko ]; then
echo "usb_wwan is found. Unloaded module and moved to usb_wwan_dup.ko"
mv /lib/modules/`uname -r`/kernel/drivers/usb/serial/usb_wwan.ko /lib/modules/`uname -r`/kernel/drivers/usb/serial/usb_wwan_dup.ko
fi
MODLOADED="`/sbin/lsmod | grep GobiSerial`"
if [ "`lsmod|grep GobiSerial`" ]; then
( $QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_GOBISERIAL_NAME && echo "$QUIC_MODULE_GOBISERIAL_NAME removed successfully." ) || { echo "$QUIC_MODULE_GOBISERIAL_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
fi
# echo "Loading module $QUIC_MODULE_GOBISERIAL_NAME"
# $QUIC_MODBIN_DIR/insmod $DEST_INS_SERIAL_PATH/$QUIC_MODULE_GOBISERIAL_NAME gQTIModemInfFilePath=$QUIC_MODEM_INF_PATH debug=0
MODLOADED="`/sbin/lsmod | grep QdssDiag`"
if [ "`lsmod|grep QdssDiag`" ]; then
($QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_QDSS_DIAG_NAME && echo "$QUIC_MODULE_QDSS_DIAG_NAME removed successfully..") || { echo "$QUIC_MODULE_QDSS_DIAG_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
fi
echo "Loading module $QUIC_MODULE_QDSS_DIAG_NAME"
$QUIC_MODBIN_DIR/insmod $DEST_QDSS_DAIG_PATH/$QUIC_MODULE_QDSS_DIAG_NAME gQdssInfFilePath=$QUIC_QDSS_INF_PATH gDiagInfFilePath=$QUIC_DIAG_INF_PATH debug_g=1
MODLOADED="`/sbin/lsmod | grep mii`"
if [ "$MODLOADED" == "" ]; then
echo "To load dependency"
echo "Loading module mii"
if [[ $OSName =~ "Red Hat Enterprise Linux" ]]; then
if [ -f $QUIC_NET/mii.ko.xz ]; then
xz -d $QUIC_NET/mii.ko.xz
fi
if [ -f $QUIC_NET/mii.ko ]; then
$QUIC_MODBIN_DIR/insmod $QUIC_NET/mii.ko
fi
MODLOADED="`/sbin/lsmod | grep mii`"
if [ "$MODLOADED" == "" ]; then
echo "$OSName: mii.ko module not present at $QUIC_NET"
fi
else
$QUIC_MODBIN_DIR/insmod $QUIC_NET/mii.ko
fi
else
echo "Module mii already in place"
fi
MODLOADED="`/sbin/lsmod | grep usbnet`"
if [ "$MODLOADED" == "" ]; then
echo "To load dependency"
echo "Loading module usbnet"
if [[ $OSName =~ "Red Hat Enterprise Linux" ]]; then
if [ -f $QUIC_QMI_WWAN/usbnet.ko.xz ]; then
xz -d $QUIC_QMI_WWAN/usbnet.ko.xz
fi
if [ -f $QUIC_QMI_WWAN/usbnet.ko ]; then
$QUIC_MODBIN_DIR/insmod $QUIC_QMI_WWAN/usbnet.ko
fi
MODLOADED="`/sbin/lsmod | grep usbnet`"
if [ "$MODLOADED" == "" ]; then
echo "$OSName: usbnet.ko module not present at $QUIC_QMI_WWAN"
fi
else
$QUIC_MODBIN_DIR/insmod $QUIC_QMI_WWAN/usbnet.ko
fi
else
echo "Module usbnet already in place"
fi
# mute rmnet
MODLOADED="`/sbin/lsmod | grep GobiNet`"
if [ "$MODLOADED" == "" ]; then
echo "Loading module $QUIC_MODULE_RMNET_NAME"
else
($QUIC_MODBIN_DIR/rmmod $QUIC_MODULE_RMNET_NAME && echo "$QUIC_MODULE_RMNET_NAME removed successfully") || { echo "$QUIC_MODULE_RMNET_NAME in use"; echo "Note: Close all applications that make use of the driver, including QUTS clients."; echo "ps -aux | grep QUTS, sudo kill -9 <PID>"; echo "Try $1ation again!"; exit 1; }
fi
$QUIC_MODBIN_DIR/insmod $DEST_INS_RMNET_PATH/$QUIC_MODULE_RMNET_NAME debug_g=1 debug_aggr=0
$QUIC_MAKE_DIR/find $DEST_QUIC_PATH -type d -exec chmod 0755 {} \;
echo "Qualcomm GobiNet driver is installed at $DEST_INS_RMNET_PATH"
echo "Qualcomm INF Parser driver is installed at $DEST_INF_PATH"
echo "Qualcomm QDSS/Diag driver is installed at $DEST_QDSS_DAIG_PATH"
echo "Qualcomm Modem driver is installed at $DEST_INS_SERIAL_PATH"
echo "Qualcomm Gobi device naming rules are installed at $QUIC_UDEV_PATH"
if [ -f "$DEST_USB_PATH/ReleaseNotes*.txt" ]; then
echo "USB Release Notes available at $DEST_USB_PATH"
fi
MODUPDATE="`grep -r qtiDevInf /etc/modules`"
if [ "$MODUPDATE" == "qtiDevInf" ]; then
sed -i '/qtiDevInf/d' /etc/modules
fi
MODUPDATE="`grep -nr qtiDevInf /etc/modules`"
if [ "$MODUPDATE" == "" ]; then
echo "qtiDevInf" >> /etc/modules
fi
MODUPDATE="`grep -nr QdssDiag /etc/modules`"