mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 21:53:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
@@ -0,0 +1,41 @@
|
||||
# Compiled Lua sources
|
||||
luac.out
|
||||
|
||||
# luarocks build files
|
||||
*.src.rock
|
||||
*.zip
|
||||
*.tar.gz
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.os
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.def
|
||||
*.exp
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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 Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,35 @@
|
||||
#将openwrt顶层目录下的rules.mk文件中的内容导入进来
|
||||
include $(TOPDIR)/rules.mk
|
||||
#软件包名
|
||||
PKG_NAME:=luci-app-hypercpe
|
||||
#软件包版本
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_RELEASE:=1
|
||||
#真正编译当前软件包的目录
|
||||
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
||||
#将$(TOPDIR)/include目录下的package.mk文件中的内容导入进来
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-hypercpe
|
||||
PKGARCH:=all
|
||||
SECTION:=wrtnode
|
||||
CATEGORY:=luci
|
||||
SUBMENU :=applications
|
||||
TITLE:=luci-app-hypercpe
|
||||
DEPENDS:=+sendat +luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \
|
||||
+kmod-usb-net-qmi-wwan +kmod-usb-net-rndis +kmod-usb-serial-qualcomm \
|
||||
+kmod-usb-net-sierrawireless +kmod-usb-ohci +kmod-usb-serial \
|
||||
+kmod-usb-serial-option +kmod-usb-wdm \
|
||||
+kmod-usb2 +kmod-usb3 \
|
||||
+quectel-CM-5G +kmod-usb-net-cdc-mbim
|
||||
endef
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LINCESE_FILES:=LICENSE
|
||||
PKF_MAINTAINER:=monologue <monologuee@outlook.com>
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,8 @@
|
||||
# luci-app-hypercpe
|
||||
luci-app-hypercpe
|
||||
|
||||
luci-app-hypercpe needs sendat to work
|
||||
|
||||
git clone https://github.com/ouyangzq/sendat package/sendat
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
module("luci.controller.admin.cpe", package.seeall)
|
||||
|
||||
I18N = require "luci.i18n"
|
||||
translate = I18N.translate
|
||||
|
||||
function index()
|
||||
entry({"admin", "modem"}, firstchild(), translate("移动数据"), 25).dependent=false
|
||||
entry({"admin", "modem", "nets"}, template("cpe/net_status"), translate("信号状态"), 0)
|
||||
entry({"admin", "modem", "get_csq"}, call("action_get_csq"))
|
||||
entry({"admin", "modem", "send_atcmd"}, call("action_send_atcmd"))
|
||||
|
||||
-- entry({"admin", "modem", "sms"}, template("cpe/sms"), translate("短信信息"), 1)
|
||||
-- entry({"admin", "modem", "band"}, template("cpe/band"), translate("锁频段/锁PCI"), 1)
|
||||
entry({"admin", "modem", "at"}, template("cpe/at"), translate("AT工具"), 98)
|
||||
|
||||
if not nixio.fs.access("/etc/config/modem") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "modem", "modem"}, cbi("cpe/modem"), _("模块设置"), 99)
|
||||
|
||||
end
|
||||
|
||||
function action_send_atcmd()
|
||||
local rv ={}
|
||||
local file
|
||||
local p = luci.http.formvalue("p")
|
||||
local set = luci.http.formvalue("set")
|
||||
fixed = string.gsub(set, "\"", "~")
|
||||
port= string.gsub(p, "\"", "~")
|
||||
rv["at"] = fixed
|
||||
rv["port"] = port
|
||||
|
||||
os.execute("/usr/share/cpe/atcmd.sh \'" .. port .. "\' \'" .. fixed .. "\'")
|
||||
result = "/tmp/result.at"
|
||||
file = io.open(result, "r")
|
||||
if file ~= nil then
|
||||
rv["result"] = file:read("*all")
|
||||
file:close()
|
||||
else
|
||||
rv["result"] = " "
|
||||
end
|
||||
os.execute("/usr/share/cpe/delatcmd.sh")
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
end
|
||||
|
||||
-- function action_get_csq()
|
||||
-- local file
|
||||
-- stat = "/tmp/cpe_cell.file"
|
||||
-- file = io.open(stat, "r")
|
||||
-- local rv ={}
|
||||
|
||||
|
||||
|
||||
-- rv["modem"] = file:read("*line")
|
||||
-- rv["conntype"] = file:read("*line")
|
||||
-- rv["modid"] = file:read("*line")
|
||||
-- rv["cops"] = file:read("*line")
|
||||
-- rv["port"] = file:read("*line")
|
||||
-- rv["tempur"] = file:read("*line")
|
||||
-- rv["proto"] = file:read("*line")
|
||||
-- file:read("*line")
|
||||
|
||||
|
||||
|
||||
-- rv["imei"] = file:read("*line")
|
||||
-- rv["imsi"] = file:read("*line")
|
||||
-- rv["iccid"] =file:read("*line")
|
||||
-- rv["phone"] = file:read("*line")
|
||||
-- file:read("*line")
|
||||
|
||||
|
||||
|
||||
-- rv["mode"] = file:read("*line")
|
||||
-- rv["csq"] = file:read("*line")
|
||||
-- rv["per"] = file:read("*line")
|
||||
-- rv["rssi"] = file:read("*line")
|
||||
-- rv["ecio"] = file:read("*line")
|
||||
-- rv["ecio1"] = file:read("*line")
|
||||
-- rv["rscp"] = file:read("*line")
|
||||
-- rv["rscp1"] = file:read("*line")
|
||||
-- rv["sinr"] = file:read("*line")
|
||||
-- rv["netmode"] = file:read("*line")
|
||||
-- file:read("*line")
|
||||
|
||||
-- rssi = rv["rssi"]
|
||||
-- ecio = rv["ecio"]
|
||||
-- rscp = rv["rscp"]
|
||||
-- ecio1 = rv["ecio1"]
|
||||
-- rscp1 = rv["rscp1"]
|
||||
-- if ecio == nil then
|
||||
-- ecio = "-"
|
||||
-- end
|
||||
-- if ecio1 == nil then
|
||||
-- ecio1 = "-"
|
||||
-- end
|
||||
-- if rscp == nil then
|
||||
-- rscp = "-"
|
||||
-- end
|
||||
-- if rscp1 == nil then
|
||||
-- rscp1 = "-"
|
||||
-- end
|
||||
|
||||
-- if ecio ~= "-" then
|
||||
-- rv["ecio"] = ecio .. " dB"
|
||||
-- end
|
||||
-- if rscp ~= "-" then
|
||||
-- rv["rscp"] = rscp .. " dBm"
|
||||
-- end
|
||||
-- if ecio1 ~= " " then
|
||||
-- rv["ecio1"] = " (" .. ecio1 .. " dB)"
|
||||
-- end
|
||||
-- if rscp1 ~= " " then
|
||||
-- rv["rscp1"] = " (" .. rscp1 .. " dBm)"
|
||||
-- end
|
||||
|
||||
-- rv["mcc"] = file:read("*line")
|
||||
-- rv["mnc"] = file:read("*line")
|
||||
-- rv["rnc"] = file:read("*line")
|
||||
-- rv["rncn"] = file:read("*line")
|
||||
-- rv["lac"] = file:read("*line")
|
||||
-- rv["lacn"] = file:read("*line")
|
||||
-- rv["cid"] = file:read("*line")
|
||||
-- rv["cidn"] = file:read("*line")
|
||||
-- rv["lband"] = file:read("*line")
|
||||
-- rv["channel"] = file:read("*line")
|
||||
-- rv["pci"] = file:read("*line")
|
||||
|
||||
-- rv["date"] = file:read("*line")
|
||||
|
||||
-- rv["crate"] = translate("快速(每5秒更新一次)")
|
||||
-- luci.http.prepare_content("application/json")
|
||||
-- luci.http.write_json(rv)
|
||||
-- end
|
||||
|
||||
function action_get_csq()
|
||||
local stat = "/tmp/cpe_cell.file"
|
||||
local file = io.open(stat, "r")
|
||||
|
||||
-- 检查文件是否成功打开
|
||||
if not file then
|
||||
-- 处理文件打开失败的情况
|
||||
return
|
||||
end
|
||||
|
||||
local rv = {}
|
||||
local keys = {"modem", "conntype", "modid", "cops", "port", "tempur", "proto", "skip", "imei", "imsi", "iccid", "phone", "skip", "mode", "csq", "per", "rssi", "ecio", "ecio1", "rscp", "rscp1", "sinr", "netmode", "skip", "mcc", "mnc", "rnc", "rncn", "lac", "lacn", "cid", "cidn", "lband", "channel", "pci", "date", "crate"}
|
||||
|
||||
for i, key in ipairs(keys) do
|
||||
local value = file:read("*line")
|
||||
-- 跳过分隔行
|
||||
if key ~= "skip" then
|
||||
rv[key] = value or "" -- 使用空字符串替换 nil(未设置或空行)
|
||||
end
|
||||
end
|
||||
|
||||
file:close()
|
||||
|
||||
-- 设置额外的字段
|
||||
rv["crate"] = translate("快速(每5秒更新一次)")
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
end
|
||||
@@ -0,0 +1,88 @@
|
||||
local m, section,s2
|
||||
|
||||
m = Map("modem", translate("Mobile Network"))
|
||||
m.description = translate("Modem Server For OpenWrt")
|
||||
|
||||
section = m:section(TypedSection, "ndis", translate("SIM Settings"), translate("Automatic operation upon startup \r\n ooo"))
|
||||
section.anonymous = true
|
||||
section.addremove = false
|
||||
section:tab("general", translate("General Setup"))
|
||||
section:tab("advanced", translate("Advanced Settings"))
|
||||
|
||||
|
||||
enable = section:taboption("general", Flag, "enabled", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
|
||||
device = section:taboption("general",Value, "device", translate("Modem device"))
|
||||
device.rmempty = false
|
||||
local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*")
|
||||
if device_suggestions then
|
||||
local node
|
||||
for node in device_suggestions do
|
||||
device:value(node)
|
||||
end
|
||||
end
|
||||
apn = section:taboption("general", Value, "apn", translate("APN"))
|
||||
username = section:taboption("general", Value, "username", translate("PAP/CHAP Username"))
|
||||
password = section:taboption("general", Value, "password", translate("PAP/CHAP Password"))
|
||||
password.password = true
|
||||
pincode = section:taboption("general", Value, "pincode", translate("PIN Code"))
|
||||
auth = section:taboption("general", Value, "auth", translate("Authentication Type"))
|
||||
auth.rmempty = true
|
||||
auth:value("", translate("-- Please choose --"))
|
||||
auth:value("both", "PAP/CHAP (both)")
|
||||
auth:value("pap", "PAP")
|
||||
auth:value("chap", "CHAP")
|
||||
auth:value("none", "NONE")
|
||||
tool = section:taboption("general", Value, "tool", translate("Tools"))
|
||||
tool:value("quectel-CM", "quectel-CM")
|
||||
tool.rmempty = true
|
||||
PdpType= section:taboption("general", Value, "pdptype", translate("PdpType"))
|
||||
PdpType:value("IPV4", "IPV4")
|
||||
PdpType:value("IPV6", "IPV6")
|
||||
PdpType:value("IPV4V6", "IPV4V6")
|
||||
PdpType.rmempty = true
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s2 = m:section(TypedSection, "ndis", translate("Network Diagnostics"),translate("Network exception handling: \
|
||||
check the network connection in a loop for 5 seconds. If the Ping IP address is not successful, After the network \
|
||||
exceeds the abnormal number, restart and search the registered network again."))
|
||||
s2.anonymous = true
|
||||
s2.addremove = false
|
||||
|
||||
en = s2:option(Flag, "en", translate("Enable"))
|
||||
en.rmempty = false
|
||||
|
||||
|
||||
|
||||
ipaddress= s2:option(Value, "ipaddress", translate("Ping IP address"))
|
||||
ipaddress.default = "119.29.29.29"
|
||||
ipaddress.rmempty=false
|
||||
|
||||
an = s2:option(Value, "an", translate("Abnormal number"))
|
||||
an.default = "15"
|
||||
an:value("3", "3")
|
||||
an:value("5", "5")
|
||||
an:value("10", "10")
|
||||
an:value("15", "15")
|
||||
an:value("20", "20")
|
||||
an:value("25", "25")
|
||||
an:value("30", "30")
|
||||
an.rmempty=false
|
||||
|
||||
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
-- io.popen("/etc/init.d/modeminit restart")
|
||||
io.popen("/etc/init.d/modem restart")
|
||||
end
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,152 @@
|
||||
<%+header%>
|
||||
<%
|
||||
local sys = require "luci.sys"
|
||||
local utl = require "luci.util"
|
||||
local fs = require "nixio.fs"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local s = uci:get("custom", "bandlock", "enabled")
|
||||
local a = uci:get("custom", "atcmd", "enabled")
|
||||
|
||||
local multilock = uci:get("custom", "multiuser", "multi") or "0"
|
||||
local rootlock = uci:get("custom", "multiuser", "root") or "0"
|
||||
nomulti=1
|
||||
if (multilock == "0") or (multilock == "1" and rootlock == "1") then
|
||||
nosms = 1
|
||||
if a == "1" then
|
||||
nosms = 0
|
||||
end
|
||||
else
|
||||
nosms = 1
|
||||
nomulti = 0
|
||||
end
|
||||
block = 1
|
||||
if s == "1" then
|
||||
block = 0
|
||||
end
|
||||
|
||||
function showicon(lck)
|
||||
end
|
||||
|
||||
-%>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
|
||||
function sendcmd(event)
|
||||
{
|
||||
|
||||
var v = document.getElementById("drop1").value;
|
||||
var s = document.getElementById("atcmd").value;
|
||||
var r =document.getElementById("attxt").value;
|
||||
if ( s.length == 0 )
|
||||
{
|
||||
|
||||
document.getElementById("attxt").value= '<%:请输入AT命令!%>\r' + r;
|
||||
return false;
|
||||
}
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "modem", "send_atcmd")%>',
|
||||
{ set: s , p: v},
|
||||
function(x, rv)
|
||||
{
|
||||
var pd = rv.result;
|
||||
document.getElementById("attxt").value=pd + r;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
function sendclean(event)
|
||||
{
|
||||
document.getElementById("attxt").value='';
|
||||
}
|
||||
|
||||
|
||||
//]]></script>
|
||||
|
||||
|
||||
<div class="cbi-map" id="cbi-misc">
|
||||
<h2><a id="content" name="content"><%:AT命令工具%></a></h2>
|
||||
<div class="cbi-map-descr"><%:AT命令工具%></div>
|
||||
<head>
|
||||
<style>
|
||||
input {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#popup {
|
||||
width:560px;
|
||||
height:190px;
|
||||
padding:20px;
|
||||
background-color:gainsboro;
|
||||
border-style : solid;
|
||||
position:fixed;
|
||||
top : 40%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
display:none;
|
||||
}
|
||||
textarea{
|
||||
background:#373737;
|
||||
border:none;
|
||||
color:#FFF;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-term">
|
||||
<legend><%:AT命令终端%></legend>
|
||||
<div id="popup">
|
||||
<table width="500" border="0">
|
||||
<tr>
|
||||
<td width="50px"><div><%:Enter Password to Unlock Full Terminal%></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200px"><input id="pass" type="password"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="image" src="<%=showicon(0)%>" style="width:48px;height:48px;" onclick="return done()" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<table width="700" border="0" id="droptxt">
|
||||
<tr>
|
||||
<td width="10%"><div align="right"><%:模块端口 : %></div></td>
|
||||
<td width="15%">
|
||||
<select style="width:200px" name="atdrop" id="drop1">
|
||||
<option value="0">ttyUSB0</option>
|
||||
<option value="1">ttyUSB1</option>
|
||||
<option value="2" selected>ttyUSB2</option>
|
||||
<option value="3">ttyUSB3</option>
|
||||
<option value="4">ttyUSB4</option>
|
||||
<option value="5">ttyUSB5</option>
|
||||
<option value="6">ttyUSB6</option>
|
||||
<option value="7">ttyUSB7</option>
|
||||
<option value="8">ttyUSB8</option>
|
||||
<option value="9">ttyUSB9</option>
|
||||
<option value="10">ttyUSB10</option>
|
||||
<option value="11">ttyUSB11</option>
|
||||
<option value="12">ttyUSB12</option>
|
||||
</select>
|
||||
</td>
|
||||
<td width="10%"><div align="right"><%:AT命令 : %></div></td>
|
||||
<td width="15%"><input style="visibility:visible;width: 500px;maxlength="200" type="text" name="atcmdlck" id="atcmd" class="cbi-input-text"></input></td>
|
||||
<td width="10%">
|
||||
<input style="visibility:visible" type="submit" id="sendat" class="cbi-button cbi-button-apply" value="<%:发送%>" onclick="return sendcmd()" />
|
||||
<input style="visibility:visible" type="submit" id="sendclean" class="cbi-button cbi-button-reset" value="<%:清除%>" onclick="return sendclean()" />
|
||||
</td>
|
||||
<td width="47%"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<textarea readonly="readonly" name="attxt" id="attxt" rows="50" style="width: 100%;" maxlength="160"></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<%+footer%>
|
||||
@@ -0,0 +1,296 @@
|
||||
<%+header%>
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
nosms = 1
|
||||
if not fs.stat("/etc/nosim") then
|
||||
nosms = 0
|
||||
end
|
||||
havegps = 0
|
||||
if fs.stat("/etc/havegps") then
|
||||
havegps = 1
|
||||
end
|
||||
-%>
|
||||
<style>g {color:grey; font-size:75%; vertical-align: super;}</style>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
modemtype=0;
|
||||
cell=0;
|
||||
portx="-";
|
||||
phonenx = "";
|
||||
hided = 0;
|
||||
|
||||
XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "modem", "get_csq")%>', null,
|
||||
function(x, rv)
|
||||
{
|
||||
document.getElementById('date').innerHTML=rv.date;
|
||||
|
||||
document.getElementById('csq').innerHTML=rv.csq;
|
||||
document.getElementById('per').innerHTML=rv.per;
|
||||
document.getElementById('rssi').innerHTML=rv.rssi;
|
||||
document.getElementById('modem').innerHTML=rv.modem;
|
||||
document.getElementById('cops').innerHTML=rv.cops;
|
||||
document.getElementById('mode').innerHTML=rv.mode;
|
||||
document.getElementById('lac').innerHTML=rv.lac;
|
||||
document.getElementById('cid').innerHTML=rv.cid;
|
||||
document.getElementById('lacn').innerHTML=rv.lacn;
|
||||
document.getElementById('cidn').innerHTML=rv.cidn;
|
||||
document.getElementById('mcc').innerHTML=rv.mcc;
|
||||
document.getElementById('mnc').innerHTML=rv.mnc;
|
||||
document.getElementById('rnc').innerHTML=rv.rnc;
|
||||
document.getElementById('rncn').innerHTML=rv.rncn;
|
||||
document.getElementById('down').innerHTML=rv.down;
|
||||
document.getElementById('up').innerHTML=rv.up;
|
||||
document.getElementById('ecio').innerHTML=rv.ecio;
|
||||
document.getElementById('rscp').innerHTML=rv.rscp;
|
||||
document.getElementById('ecio1').innerHTML=rv.ecio1;
|
||||
document.getElementById('rscp1').innerHTML=rv.rscp1;
|
||||
document.getElementById('conntype').innerHTML=rv.conntype;
|
||||
document.getElementById('chan').innerHTML=rv.channel;
|
||||
document.getElementById('lband').innerHTML=rv.lband;
|
||||
document.getElementById('conmon').innerHTML=rv.netmode;
|
||||
document.getElementById('tempur').innerHTML=rv.tempur;
|
||||
|
||||
document.getElementById('pci').innerHTML=rv.pci;
|
||||
document.getElementById('sinr').innerHTML=rv.sinr;
|
||||
|
||||
document.getElementById('imei').innerHTML=rv.imei;
|
||||
document.getElementById('imsi').innerHTML=rv.imsi;
|
||||
document.getElementById('iccid').innerHTML=rv.iccid;
|
||||
document.getElementById('phone').innerHTML=rv.phone;
|
||||
|
||||
|
||||
<% if havegps == 1 then %>
|
||||
document.getElementById('lat').innerHTML=rv.lat;
|
||||
document.getElementById('long').innerHTML=rv.long;
|
||||
<% end %>
|
||||
// document.getElementById('idvp').innerHTML=rv.modid;
|
||||
// document.getElementById('proto').innerHTML=rv.proto;
|
||||
// document.getElementById('port').innerHTML=rv.port;
|
||||
|
||||
// document.getElementById('crate').innerHTML=rv.crate;
|
||||
// if (phonenx == "")
|
||||
// {
|
||||
// document.getElementById('phone').value=rv.phone;
|
||||
// document.getElementById('phonen').value=rv.phonen;
|
||||
// phonenx = document.getElementById('phone').value;
|
||||
// document.getElementById("phone").disabled=false;
|
||||
// document.getElementById("phonen").disabled=false;
|
||||
// document.getElementById("pho").disabled=false;
|
||||
// }
|
||||
|
||||
// if (rv.phone == "-")
|
||||
// {
|
||||
// document.getElementById('phone').value="-";
|
||||
// document.getElementById('phonen').value="-";
|
||||
// document.getElementById("pho").disabled=true;
|
||||
// document.getElementById("phone").disabled=true;
|
||||
// document.getElementById("phonen").disabled=true;
|
||||
// phonenx = "";
|
||||
// }
|
||||
|
||||
// simerr = rv.simerr;
|
||||
// if (simerr == "0")
|
||||
// {
|
||||
// document.getElementById("simwarn").style.display="none";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// document.getElementById("simwarn").style.display="block";
|
||||
// document.getElementById("simsg").style.color = "red";
|
||||
// if (simerr == "1")
|
||||
// {
|
||||
// document.getElementById("simsg").innerHTML = "<%:SIM卡已锁定,个人资料中未输入SIM Pin!!%>";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (simerr == "2")
|
||||
// {
|
||||
// document.getElementById("simsg").innerHTML = "<%:解锁SIM卡的Pin不正确%>";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (simerr == "3")
|
||||
// {
|
||||
// document.getElementById("simsg").innerHTML = "<%:无效SIM卡%>";
|
||||
// } else
|
||||
// {
|
||||
// document.getElementById("simsg").innerHTML = "<%:SIM卡未锁定.错误的SIM卡%>";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// reslt=rv.result
|
||||
|
||||
// portx=rv.port
|
||||
// if (portx == "-" )
|
||||
// {
|
||||
// document.getElementById('inc1').style.display="none";
|
||||
// document.getElementById('dec1').style.display="none";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// document.getElementById('inc1').style.display="block";
|
||||
// document.getElementById('dec1').style.display="block";
|
||||
// }
|
||||
|
||||
// host = rv.host;
|
||||
// if(host == "1")
|
||||
// {
|
||||
// document.getElementById("pho").disabled=true;
|
||||
// }
|
||||
}
|
||||
);
|
||||
|
||||
function clear_data()
|
||||
{
|
||||
document.getElementById('port').innerHTML="<%:Changing Port%>";
|
||||
document.getElementById('csq').innerHTML="-";
|
||||
document.getElementById('per').innerHTML="-";
|
||||
document.getElementById('rssi').innerHTML="-";
|
||||
document.getElementById('modem').innerHTML="-";
|
||||
document.getElementById('cops').innerHTML="-";
|
||||
document.getElementById('mode').innerHTML="-";
|
||||
document.getElementById('lac').innerHTML="-";
|
||||
document.getElementById('cid').innerHTML="-";
|
||||
document.getElementById('lacn').innerHTML="-";
|
||||
document.getElementById('cidn').innerHTML="-";
|
||||
document.getElementById('mcc').innerHTML="-";
|
||||
document.getElementById('mnc').innerHTML="-";
|
||||
document.getElementById('rnc').innerHTML="-";
|
||||
document.getElementById('rncn').innerHTML="-";
|
||||
document.getElementById('down').innerHTML="-";
|
||||
document.getElementById('up').innerHTML="-";
|
||||
document.getElementById('ecio').innerHTML="-";
|
||||
document.getElementById('rscp').innerHTML="-";
|
||||
document.getElementById('ecio1').innerHTML="-";
|
||||
document.getElementById('rscp1').innerHTML="-";
|
||||
document.getElementById('netmode').innerHTML="-";
|
||||
document.getElementById('conntype').innerHTML=" ";
|
||||
document.getElementById('chan').innerHTML=" ";
|
||||
document.getElementById('conmon').innerHTML="-";
|
||||
document.getElementById('phone').value="-";
|
||||
|
||||
|
||||
document.getElementById('imei').innerHTML="-";
|
||||
document.getElementById('imsi').innerHTML="-";
|
||||
document.getElementById('iccid').innerHTML="-";
|
||||
document.getElementById('lband').innerHTML="-";
|
||||
document.getElementById('pci').innerHTML="-";
|
||||
<% if havegps == 1 then %>
|
||||
document.getElementById('lat').innerHTML="-";
|
||||
document.getElementById('long').innerHTML="-";
|
||||
<% end %>
|
||||
|
||||
// document.getElementById('idvp').innerHTML="-";
|
||||
// document.getElementById('phonen').value="-";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//]]></script>
|
||||
|
||||
|
||||
<div class="cbi-map" id="cbi-modem">
|
||||
<h2><a id="content" name="content"><%:信号状态/模块信息%></a></h2>
|
||||
<div class="cbi-map-descr">请注意该插件只支持移远模块,未来也不会支持其他模块
|
||||
</div>
|
||||
|
||||
<fieldset class="cbi-section" id="simwarn" style="display:none;">
|
||||
<legend><%:SIM警告%></legend>
|
||||
<table width="550" border="0">
|
||||
<tr>
|
||||
<td width="10%"></td>
|
||||
<td width="60%"><div align="left" id="simsg" style="font-size:1.875em"><strong></strong></div></td>
|
||||
<td width="30%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-mod">
|
||||
<legend><%:综合信息%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:模块 :%></td><td id="modem">-</td><td></td></tr>
|
||||
<tr><td width="20%"><%:制造商 :%></td><td id="conntype"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:温度 : %></td><td id="tempur"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:更新时间 : %></td><td id="date"></td><td></td></tr>
|
||||
<!-- <tr><td width="20%"><%:ID : %></td><td id="idvp"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:端口 : %></td><td id="port"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:协议 : %></td><td id="proto"></td><td></td></tr> -->
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if nosms == 0 then %>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-msinfo">
|
||||
<legend><%:通信模块/SIM卡信息%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:运营商 : %></td><td id="cops"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:IMEI :%></td><td id="imei"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:IMSI : %></td><td id="imsi"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:ICCID : %></td><td id="iccid"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:SIM卡号码 : %></td><td id="phone"></td><td></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-sig">
|
||||
<legend><%:信号状态%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:蜂窝网络类型 :%></td><td id="mode"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:CSQ : %></td><td id="csq"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:信号强度 : %></td><td id="per"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:信号接收强度 RSSI : %></td><td id="rssi"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:参考信号接收质量 RSRQ : %></td><td><ul><span id="ecio" class="r"></span><span id="ecio1" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:参考信号接收功率 RSRP : %></td><td><ul><span id="rscp" class="r"></span><span id="rscp1" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:信噪比 SINR : %></td><td id="sinr"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:连接状态监控 : %></td><td id="conmon"></td><td></td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-sig">
|
||||
<legend><%:基站信息%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="20%"><%:MCC / MNC :%></td><td id="mcc"></td><td id="mnc"></td></tr>
|
||||
<tr><td width="20%"><%:eNB ID : %></td><td><ul><span id="rnc" class="r"></span><span id="rncn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:TAC : %></td><td><ul><span id="lac" class="r"></span><span id="lacn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:Cell ID : %></td><td><ul><span id="cid" class="r"></span><span id="cidn" class="r"></span></ul></td><td></td></tr>
|
||||
<tr><td width="20%"><%:频段 Band : %></td><td id="lband"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:频点 Channel : %></td><td id="chan"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:物理小区标识 PCI : %></td><td id="pci"></td><td></td></tr>
|
||||
<tr><td width="20%"><%:最大Qos级别 Maximum Qos : %></td><td><ul><span id="down" class="r"></span><span id="up" class="r"></span></ul></td><td></td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<% if havegps == 1 then %>
|
||||
<fieldset class="cbi-section" id="cbi-gps">
|
||||
<legend><%:GPS 定位%></legend>
|
||||
<table width="550" border="0">
|
||||
<tr>
|
||||
<td width="30%"><div align="right"><%:纬度 :%></div></td>
|
||||
<td><ul id="lat"></ul></td>
|
||||
<td width="1%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div align="right"><%:经度 :%></div></td>
|
||||
<td><ul id="long"></ul></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
<%+footer%>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
msgid "Mobile Network"
|
||||
msgstr "模块设置"
|
||||
|
||||
|
||||
msgid "Automatic operation upon startup ooo"
|
||||
msgstr "开机自动启动:勾选"
|
||||
|
||||
msgid "Tools"
|
||||
msgstr "拨号工具"
|
||||
|
||||
msgid "PAP/CHAP Username"
|
||||
msgstr "PAP/CHAP 用户"
|
||||
|
||||
msgid "PAP/CHAP Password"
|
||||
msgstr "PAP/CHAP 密码"
|
||||
|
||||
|
||||
msgid "Modem Server For OpenWrt"
|
||||
msgstr "4G/5G模块管理"
|
||||
|
||||
|
||||
msgid "SIM Settings"
|
||||
msgstr "SIM 配置 (联通ANP:3gnet) (电信APN:ctnet) (移动APN:cmnet) (广电APN:cbnet) "
|
||||
|
||||
msgid "PdpType"
|
||||
msgstr "IP获取方式"
|
||||
|
||||
msgid "AT Port Settings"
|
||||
msgstr "AT 模块配置"
|
||||
|
||||
msgid "Set tyyUSB port"
|
||||
msgstr "AT 模块端口配置 (全模块指定端口)"
|
||||
|
||||
msgid "tyyUSB port"
|
||||
msgstr "ttyUSB 配置ID"
|
||||
|
||||
msgid "Network Diagnostics"
|
||||
msgstr "网络诊断"
|
||||
|
||||
|
||||
msgid "Network Diagnostics"
|
||||
msgstr "网络诊断"
|
||||
|
||||
|
||||
msgid "Network exception handling: check the network connection in a loop for 5 seconds. If the Ping IP address is not successful, After the network exceeds the abnormal number, restart and search the registered network again."
|
||||
msgstr "网络异常处理:循环检查网络连接5秒。如果Ping IP地址不成功,则在网络超过异常数量后,重新启动并搜索已注册的网络。"
|
||||
|
||||
msgid "Ping IP address"
|
||||
msgstr "Ping IP地址"
|
||||
|
||||
msgid "Abnormal number"
|
||||
msgstr "异常次数"
|
||||
|
||||
msgid "Lock Band List"
|
||||
msgstr "锁定频段列表"
|
||||
|
||||
msgid "Server Type"
|
||||
msgstr "服务类型"
|
||||
|
||||
|
||||
msgid "[1]Automatic start upon startup: Check</br>[2] FMFMFM650-CN module default ECM (36) mode. If not, please modify it, otherwise dialing cannot proceed normally</br>"
|
||||
msgstr "【1】 开机自动启动:勾选 </br> 【2】 目前只支持移远模块,并且为QMI或者MBIM </br>"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
zh-cn
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
config ndis
|
||||
option enabled '1'
|
||||
option bandlist '0'
|
||||
option servertype '0'
|
||||
option ipaddress '119.29.29.29'
|
||||
option en '1'
|
||||
option an '5'
|
||||
option model 'nr5g'
|
||||
option tyyusb '2'
|
||||
option tool 'quectel-CM'
|
||||
option device '/dev/cdc-wdm0'
|
||||
option pdptype 'IPV4V6'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command /bin/sh /usr/share/cpe/rssi
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
Executable
+86
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
|
||||
START=16
|
||||
STOP=16
|
||||
USE_PROCD=1
|
||||
|
||||
# 运行模块配置
|
||||
runModem() {
|
||||
local enabled
|
||||
config_get_bool enabled $1 enabled
|
||||
if [ "$enabled" != "1" ]; then
|
||||
echo "Modem not enabled, skipping." >> /tmp/log4g
|
||||
return
|
||||
fi
|
||||
|
||||
echo "run runModem" >> /tmp/log4g
|
||||
|
||||
local user password apn auth pincode device tool pdptype tty atcmd
|
||||
config_get user $1 user
|
||||
config_get password $1 password
|
||||
config_get apn $1 apn
|
||||
config_get auth $1 auth
|
||||
config_get pincode $1 pincode
|
||||
config_get device $1 device
|
||||
config_get tool $1 tool
|
||||
config_get pdptype $1 pdptype
|
||||
config_get tty $1 tty
|
||||
config_get atcmd $1 atcmd
|
||||
|
||||
if [ -z "$device" ] || [ -z "$tool" ]; then
|
||||
echo "Critical configuration missing: device or tool is not set." >> /tmp/log4g
|
||||
return
|
||||
fi
|
||||
|
||||
case "$pdptype" in
|
||||
"IPV4V6") pdptype='-4 -6' ;;
|
||||
"IPV6") pdptype='-6' ;;
|
||||
*) pdptype='' ;;
|
||||
esac
|
||||
|
||||
local devname=$(basename "$device")
|
||||
local devpath=$(readlink -f "/sys/class/usbmisc/$devname/device/")
|
||||
local ifname=$(ls "$devpath/net" 2>/dev/null)
|
||||
|
||||
# 构建命令参数
|
||||
local cmd_params=""
|
||||
if [ -n "$ifname" ]; then
|
||||
cmd_params="-i $ifname"
|
||||
fi
|
||||
cmd_params="$cmd_params -s $apn $pdptype"
|
||||
|
||||
if [ -n "$password" ]; then
|
||||
cmd_params="$cmd_params $user $password $auth"
|
||||
fi
|
||||
|
||||
if [ -n "$pincode" ]; then
|
||||
cmd_params="$cmd_params -p $pincode"
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command $tool $cmd_params
|
||||
procd_set_param respawn
|
||||
echo "quectel-CM has started."
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "modem"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load modem
|
||||
config_foreach runModem ndis
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
echo "runModem stop" >> /tmp/log4g
|
||||
killall quectel-CM # 考虑使用更精确的方法来停止服务
|
||||
echo "quectel-CM has stopped."
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-modem.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-modem.json << EEOF
|
||||
{
|
||||
"config": "modem",
|
||||
"init": "modem"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@modem[-1]
|
||||
add ucitrack modem
|
||||
set ucitrack.@modem[-1].init=modem
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
printf "Band 128-bit bandmask\n"
|
||||
|
||||
# 生成 1 到 48 的频段掩码
|
||||
for LBAND in $(seq 1 48); do
|
||||
BBAND=$((1 << (LBAND - 1)))
|
||||
printf "%-6s%016X%016X\n" "$LBAND" "0" "$BBAND"
|
||||
done
|
||||
|
||||
# 生成 65 到 85 的频段掩码
|
||||
for LBAND in $(seq 65 85); do
|
||||
BBAND=$((1 << (LBAND - 65)))
|
||||
printf "%-6s%016X%016X\n" "$LBAND" "$BBAND" "0"
|
||||
done
|
||||
Executable
+317
@@ -0,0 +1,317 @@
|
||||
#!/bin/sh
|
||||
CHAN=$1
|
||||
CHAN=$(echo "$CHAN" | grep -o "[0-9]*")
|
||||
|
||||
decode_lte() {
|
||||
if [ $CHAN -lt 600 ]; then
|
||||
BAND="B1"
|
||||
elif [ $CHAN -lt 1200 ]; then
|
||||
BAND="B2"
|
||||
elif [ $CHAN -lt 1950 ]; then
|
||||
BAND="B3"
|
||||
elif [ $CHAN -lt 2400 ]; then
|
||||
BAND="B4"
|
||||
elif [ $CHAN -lt 2650 ]; then
|
||||
BAND="B5"
|
||||
elif [ $CHAN -lt 2750 ]; then
|
||||
BAND="B6"
|
||||
elif [ $CHAN -lt 3450 ]; then
|
||||
BAND="B7"
|
||||
elif [ $CHAN -lt 3800 ]; then
|
||||
BAND="B8"
|
||||
elif [ $CHAN -lt 4150 ]; then
|
||||
BAND="B9"
|
||||
elif [ $CHAN -lt 4750 ]; then
|
||||
BAND="B10"
|
||||
elif [ $CHAN -lt 4950 ]; then
|
||||
BAND="B11"
|
||||
elif [ $CHAN -lt 5010 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 5180 ]; then
|
||||
BAND="B12"
|
||||
elif [ $CHAN -lt 5280 ]; then
|
||||
BAND="B13"
|
||||
elif [ $CHAN -lt 5380 ]; then
|
||||
BAND="B14"
|
||||
elif [ $CHAN -lt 5730 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 5850 ]; then
|
||||
BAND="B17"
|
||||
elif [ $CHAN -lt 6000 ]; then
|
||||
BAND="B18"
|
||||
elif [ $CHAN -lt 6150 ]; then
|
||||
BAND="B19"
|
||||
elif [ $CHAN -lt 6450 ]; then
|
||||
BAND="B20"
|
||||
elif [ $CHAN -lt 6600 ]; then
|
||||
BAND="B21"
|
||||
elif [ $CHAN -lt 7400 ]; then
|
||||
BAND="B22"
|
||||
elif [ $CHAN -lt 7500 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 7700 ]; then
|
||||
BAND="B23"
|
||||
elif [ $CHAN -lt 8040 ]; then
|
||||
BAND="B24"
|
||||
elif [ $CHAN -lt 8690 ]; then
|
||||
BAND="B25"
|
||||
elif [ $CHAN -lt 9040 ]; then
|
||||
BAND="B26"
|
||||
elif [ $CHAN -lt 9210 ]; then
|
||||
BAND="B27"
|
||||
elif [ $CHAN -lt 9660 ]; then
|
||||
BAND="B28"
|
||||
elif [ $CHAN -lt 9770 ]; then
|
||||
BAND="B29"
|
||||
elif [ $CHAN -lt 9870 ]; then
|
||||
BAND="B30"
|
||||
elif [ $CHAN -lt 9920 ]; then
|
||||
BAND="B31"
|
||||
elif [ $CHAN -lt 10400 ]; then
|
||||
BAND="B32"
|
||||
elif [ $CHAN -lt 36000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 36200 ]; then
|
||||
BAND="B33"
|
||||
elif [ $CHAN -lt 36350 ]; then
|
||||
BAND="B34"
|
||||
elif [ $CHAN -lt 36950 ]; then
|
||||
BAND="B35"
|
||||
elif [ $CHAN -lt 37550 ]; then
|
||||
BAND="B36"
|
||||
elif [ $CHAN -lt 37750 ]; then
|
||||
BAND="B37"
|
||||
elif [ $CHAN -lt 38250 ]; then
|
||||
BAND="B38"
|
||||
elif [ $CHAN -lt 38650 ]; then
|
||||
BAND="B39"
|
||||
elif [ $CHAN -lt 39650 ]; then
|
||||
BAND="B40"
|
||||
elif [ $CHAN -lt 41590 ]; then
|
||||
BAND="B41"
|
||||
elif [ $CHAN -lt 43590 ]; then
|
||||
BAND="B42"
|
||||
elif [ $CHAN -lt 45590 ]; then
|
||||
BAND="B43"
|
||||
elif [ $CHAN -lt 46590 ]; then
|
||||
BAND="B44"
|
||||
elif [ $CHAN -lt 46790 ]; then
|
||||
BAND="B45"
|
||||
elif [ $CHAN -lt 54540 ]; then
|
||||
BAND="B46"
|
||||
elif [ $CHAN -lt 55240 ]; then
|
||||
BAND="B47"
|
||||
elif [ $CHAN -lt 56740 ]; then
|
||||
BAND="B48"
|
||||
elif [ $CHAN -lt 58240 ]; then
|
||||
BAND="B49"
|
||||
elif [ $CHAN -lt 59090 ]; then
|
||||
BAND="B50"
|
||||
elif [ $CHAN -lt 59140 ]; then
|
||||
BAND="B51"
|
||||
elif [ $CHAN -lt 60140 ]; then
|
||||
BAND="B52"
|
||||
elif [ $CHAN -lt 60255 ]; then
|
||||
BAND="B53"
|
||||
elif [ $CHAN -lt 65536 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 66436 ]; then
|
||||
BAND="B65"
|
||||
elif [ $CHAN -lt 67336 ]; then
|
||||
BAND="B66"
|
||||
elif [ $CHAN -lt 67536 ]; then
|
||||
BAND="B67"
|
||||
elif [ $CHAN -lt 67836 ]; then
|
||||
BAND="B68"
|
||||
elif [ $CHAN -lt 68336 ]; then
|
||||
BAND="B69"
|
||||
elif [ $CHAN -lt 68586 ]; then
|
||||
BAND="B70"
|
||||
elif [ $CHAN -lt 68936 ]; then
|
||||
BAND="B71"
|
||||
elif [ $CHAN -lt 68986 ]; then
|
||||
BAND="B72"
|
||||
elif [ $CHAN -lt 69036 ]; then
|
||||
BAND="B73"
|
||||
elif [ $CHAN -lt 69466 ]; then
|
||||
BAND="B74"
|
||||
elif [ $CHAN -lt 70316 ]; then
|
||||
BAND="B75"
|
||||
elif [ $CHAN -lt 70366 ]; then
|
||||
BAND="B76"
|
||||
elif [ $CHAN -lt 70546 ]; then
|
||||
BAND="B85"
|
||||
elif [ $CHAN -lt 70596 ]; then
|
||||
BAND="B87"
|
||||
elif [ $CHAN -lt 70646 ]; then
|
||||
BAND="B88"
|
||||
else
|
||||
BAND="-"
|
||||
fi
|
||||
}
|
||||
|
||||
decode_nr5g() {
|
||||
if [ $CHAN -lt 123400 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 130400 ]; then
|
||||
BAND="n71"
|
||||
elif [ $CHAN -lt 143400 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 145600 ]; then
|
||||
BAND="n29"
|
||||
elif [ $CHAN -eq 145600 ]; then
|
||||
BAND="n29|n85"
|
||||
elif [ $CHAN -lt 145800 ]; then
|
||||
BAND="n85"
|
||||
elif [ $CHAN -eq 145800 ]; then
|
||||
BAND="n12|n85"
|
||||
elif [ $CHAN -lt 147600 ]; then
|
||||
BAND="n12|n85"
|
||||
elif [ $CHAN -lt 149200 ]; then
|
||||
BAND="n12|n67|n85"
|
||||
elif [ $CHAN -eq 149200 ]; then
|
||||
BAND="n12|n13|n67|n85"
|
||||
elif [ $CHAN -le 151200 ]; then
|
||||
BAND="n13|n67"
|
||||
elif [ $CHAN -lt 151600 ]; then
|
||||
BAND="n67"
|
||||
elif [ $CHAN -eq 151600 ]; then
|
||||
BAND="n14|n28|n67"
|
||||
elif [ $CHAN -le 153600 ]; then
|
||||
BAND="n14|n28"
|
||||
elif [ $CHAN -lt 158200 ]; then
|
||||
BAND="n28"
|
||||
elif [ $CHAN -eq 158200 ]; then
|
||||
BAND="n14|n20|n28"
|
||||
elif [ $CHAN -le 160600 ]; then
|
||||
BAND="n20|n28"
|
||||
elif [ $CHAN -le 164200 ]; then
|
||||
BAND="n20"
|
||||
elif [ $CHAN -lt 171800 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 172000 ]; then
|
||||
BAND="n26"
|
||||
elif [ $CHAN -lt 173800 ]; then
|
||||
BAND="n18|n26"
|
||||
elif [ $CHAN -le 175000 ]; then
|
||||
BAND="n5|n18|n26"
|
||||
elif [ $CHAN -le 178800 ]; then
|
||||
BAND="n5|n26"
|
||||
elif [ $CHAN -lt 185000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 192000 ]; then
|
||||
BAND="n8"
|
||||
elif [ $CHAN -lt 285400 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 286400 ]; then
|
||||
BAND="n51|n76|n91|n93"
|
||||
elif [ $CHAN -eq 286400 ]; then
|
||||
BAND="n50|n51|n75|n76|n91|92|n93|94"
|
||||
elif [ $CHAN -lt 295000 ]; then
|
||||
BAND="n50|n75|n92|n94"
|
||||
elif [ $CHAN -eq 295000 ]; then
|
||||
BAND="n50|n74|n75|n92|n94"
|
||||
elif [ $CHAN -le 303400 ]; then
|
||||
BAND="n50|n74|n75|n92|n94"
|
||||
elif [ $CHAN -le 303600 ]; then
|
||||
BAND="n74"
|
||||
elif [ $CHAN -lt 305000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 311800 ]; then
|
||||
BAND="n24"
|
||||
elif [ $CHAN -lt 361000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 376000 ]; then
|
||||
BAND="n3"
|
||||
elif [ $CHAN -eq 376000 ]; then
|
||||
BAND="n3|n39"
|
||||
elif [ $CHAN -le 384000 ]; then
|
||||
BAND="n39"
|
||||
elif [ $CHAN -lt 386000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 398000 ]; then
|
||||
BAND="n2|n25"
|
||||
elif [ $CHAN -lt 399000 ]; then
|
||||
BAND="n25"
|
||||
elif [ $CHAN -eq 399000 ]; then
|
||||
BAND="n25|n70"
|
||||
elif [ $CHAN -lt 402000 ]; then
|
||||
BAND="n70"
|
||||
elif [ $CHAN -eq 402000 ]; then
|
||||
BAND="n34|n70"
|
||||
elif [ $CHAN -le 404000 ]; then
|
||||
BAND="n34|n70"
|
||||
elif [ $CHAN -le 405000 ]; then
|
||||
BAND="n34"
|
||||
elif [ $CHAN -lt 422000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 434000 ]; then
|
||||
BAND="n1|n65|n66"
|
||||
elif [ $CHAN -le 440000 ]; then
|
||||
BAND="n65|n66"
|
||||
elif [ $CHAN -lt 460000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 470000 ]; then
|
||||
BAND="n40"
|
||||
elif [ $CHAN -eq 470000 ]; then
|
||||
BAND="n30|n40"
|
||||
elif [ $CHAN -le 472000 ]; then
|
||||
BAND="n30|n40"
|
||||
elif [ $CHAN -le 480000 ]; then
|
||||
BAND="n40"
|
||||
elif [ $CHAN -lt 496700 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 499000 ]; then
|
||||
BAND="n53"
|
||||
elif [ $CHAN -lt 499200 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 514000 ]; then
|
||||
BAND="n41|n90"
|
||||
elif [ $CHAN -eq 514000 ]; then
|
||||
BAND="n38|n41|n90"
|
||||
elif [ $CHAN -lt 524000 ]; then
|
||||
BAND="n38|n41|n90"
|
||||
elif [ $CHAN -eq 524000 ]; then
|
||||
BAND="n7|n38|n41|n90"
|
||||
elif [ $CHAN -lt 538000 ]; then
|
||||
BAND="n7|n41|n90"
|
||||
elif [ $CHAN -eq 538000 ]; then
|
||||
BAND="n7|n90"
|
||||
elif [ $CHAN -lt 620000 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 636667 ]; then
|
||||
BAND="n77|n78"
|
||||
elif [ $CHAN -le 646666 ]; then
|
||||
BAND="n48|n77|n78"
|
||||
elif [ $CHAN -le 653333 ]; then
|
||||
BAND="n77|n78"
|
||||
elif [ $CHAN -le 680000 ]; then
|
||||
BAND="n77"
|
||||
elif [ $CHAN -lt 693334 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -le 733333 ]; then
|
||||
BAND="n79"
|
||||
elif [ $CHAN -lt 743333 ]; then
|
||||
BAND="-"
|
||||
elif [ $CHAN -lt 795000 ]; then
|
||||
BAND="n46"
|
||||
elif [ $CHAN -eq 795000 ]; then
|
||||
BAND="n46|n96"
|
||||
elif [ $CHAN -le 875000 ]; then
|
||||
BAND="n96"
|
||||
else
|
||||
BAND="-"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "$CHAN" ]; then
|
||||
BAND="-"
|
||||
elif [ "$CHAN" -lt 123400 ]; then
|
||||
decode_lte
|
||||
elif [ "$CHAN" -le 875000 ]; then
|
||||
decode_nr5g
|
||||
else
|
||||
BAND="-"
|
||||
fi
|
||||
echo $BAND
|
||||
exit
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local MAX_BAND = 128
|
||||
local BIT_WIDTH = 4
|
||||
local mtab = {}
|
||||
local vtab = {1, 2, 4, 8}
|
||||
|
||||
-- 初始化 mtab
|
||||
for i = 1, 32 do
|
||||
mtab[i] = 0
|
||||
end
|
||||
|
||||
-- 检查和处理每个参数
|
||||
for _, band in ipairs(arg) do
|
||||
local band_num = tonumber(band)
|
||||
if band_num and band_num <= MAX_BAND then
|
||||
local idx = math.floor((band_num - 1) / BIT_WIDTH) + 1
|
||||
local idxr = 33 - idx
|
||||
local val = vtab[(band_num - ((idx - 1) * BIT_WIDTH))]
|
||||
mtab[idxr] = mtab[idxr] + val
|
||||
else
|
||||
print("Invalid input: " .. band)
|
||||
end
|
||||
end
|
||||
|
||||
-- 转换 mtab 到十六进制字符串
|
||||
for i = 1, 32 do
|
||||
mtab[i] = string.format("%X", mtab[i])
|
||||
end
|
||||
|
||||
print(table.concat(mtab))
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 检查参数
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <process_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOOKFOR="$1"
|
||||
|
||||
# 使用 pgrep 来更精确地查找进程
|
||||
# pgrep 默认匹配整个进程名称
|
||||
# -f 选项使其匹配命令行参数
|
||||
# 使用 -o 选项以获得最早启动的进程的 PID
|
||||
# 你可以根据需要删除 -o,以杀死所有匹配的进程
|
||||
PID=$(pgrep -fo "$LOOKFOR")
|
||||
|
||||
# 检查是否找到了进程
|
||||
if [ -z "$PID" ]; then
|
||||
echo "No process found matching '$LOOKFOR'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 杀死进程
|
||||
kill "$PID" || {
|
||||
echo "Failed to kill process with PID $PID"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Process $PID killed successfully"
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
-- 参数验证
|
||||
if #arg < 2 then
|
||||
print("Usage: script <rsrp> <bw>")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
rsrp = tonumber(arg[1])
|
||||
bw = tonumber(arg[2])
|
||||
|
||||
-- 检查参数是否正确转换为数字
|
||||
if rsrp == nil or bw == nil then
|
||||
print("Error: Invalid input. Both rsrp and bw should be numbers.")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
-- 根据带宽计算 n 的值
|
||||
local n
|
||||
if bw == 1.4 then
|
||||
n = 6
|
||||
else
|
||||
n = bw * 5
|
||||
end
|
||||
|
||||
-- 计算 RSSI
|
||||
local rssi = rsrp + (10 * math.log10(n * 12))
|
||||
|
||||
-- 限制 RSSI 的范围
|
||||
if rssi < -113 then
|
||||
rssi = -113
|
||||
elseif rssi > -51 then
|
||||
rssi = -51
|
||||
end
|
||||
|
||||
print(math.floor(rssi))
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
PIN=$1
|
||||
VALUE=$2
|
||||
|
||||
PIN_FILE=/sys/class/gpio/gpio$PIN
|
||||
|
||||
if [ -z "$PIN" -o -z "$VALUE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $PIN >/sys/class/gpio/export
|
||||
|
||||
if [ $(cat $PIN_FILE/direction) = "out" ]; then
|
||||
echo $VALUE >$PIN_FILE/value
|
||||
fi
|
||||
|
||||
echo $PIN >/sys/class/gpio/unexport
|
||||
@@ -0,0 +1,507 @@
|
||||
#!/bin/sh
|
||||
ATPORT=2
|
||||
#Quectel
|
||||
lte_bw() {
|
||||
BW=$(echo $BW | grep -o "[0-5]\{1\}")
|
||||
case $BW in
|
||||
"0")
|
||||
BW="1.4" ;;
|
||||
"1")
|
||||
BW="3" ;;
|
||||
"2"|"3"|"4"|"5")
|
||||
BW=$((($(echo $BW) - 1) * 5)) ;;
|
||||
esac
|
||||
}
|
||||
#Quectel
|
||||
nr_bw() {
|
||||
BW=$(echo $BW | grep -o "[0-9]\{1,2\}")
|
||||
case $BW in
|
||||
"0"|"1"|"2"|"3"|"4"|"5")
|
||||
BW=$((($(echo $BW) + 1) * 5)) ;;
|
||||
"6"|"7"|"8"|"9"|"10"|"11"|"12")
|
||||
BW=$((($(echo $BW) - 2) * 10)) ;;
|
||||
"13")
|
||||
BW="200" ;;
|
||||
"14")
|
||||
BW="400" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
#��ѯ��Ϣǿ��
|
||||
All_CSQ()
|
||||
{
|
||||
Debug "All_CSQ"
|
||||
#�ź�
|
||||
OX=$( sendat $ATPORT "AT+CSQ" |grep "+CSQ:")
|
||||
OX=$(echo $OX | tr 'a-z' 'A-Z')
|
||||
CSQ=$(echo "$OX" | grep -o "+CSQ: [0-9]\{1,2\}" | grep -o "[0-9]\{1,2\}")
|
||||
if [ $CSQ = "99" ]; then
|
||||
CSQ=""
|
||||
fi
|
||||
if [ -n "$CSQ" ]; then
|
||||
CSQ_PER=$(($CSQ * 100/31))"%"
|
||||
CSQ_RSSI=$((2 * CSQ - 113))" dBm"
|
||||
else
|
||||
CSQ="-"
|
||||
CSQ_PER="-"
|
||||
CSQ_RSSI="-"
|
||||
fi
|
||||
}
|
||||
|
||||
Quectel_SIMINFO()
|
||||
{
|
||||
Debug "Quectel_SIMINFO"
|
||||
# ��ȡIMEI
|
||||
IMEI=$( sendat $ATPORT "AT+CGSN" | sed -n '2p' )
|
||||
# ��ȡIMSI
|
||||
IMSI=$( sendat $ATPORT "AT+CIMI" | sed -n '2p' )
|
||||
# ��ȡICCID
|
||||
ICCID=$( sendat $ATPORT "AT+ICCID" | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}" )
|
||||
# ��ȡ�绰����
|
||||
phone=$( sendat $ATPORT "AT+CNUM" | grep "+CNUM:" )
|
||||
|
||||
}
|
||||
# SIMCOM��ȡ��վ��Ϣ
|
||||
Quectel_Cellinfo()
|
||||
{
|
||||
# return
|
||||
#cellinfo0.gcom
|
||||
OX1=$( sendat $ATPORT "AT+COPS=3,0;+COPS?")
|
||||
OX2=$( sendat $ATPORT "AT+COPS=3,2;+COPS?")
|
||||
OX=$OX1" "$OX2
|
||||
|
||||
#cellinfo.gcom
|
||||
OY1=$( sendat $ATPORT "AT+CREG=2;+CREG?;+CREG=0")
|
||||
OY2=$( sendat $ATPORT "AT+CEREG=2;+CEREG?;+CEREG=0")
|
||||
OY3=$( sendat $ATPORT "AT+C5GREG=2;+C5GREG?;+C5GREG=0")
|
||||
OY=$OY1" "$OY2" "$OY3
|
||||
|
||||
|
||||
OXx=$OX
|
||||
OX=$(echo $OX | tr 'a-z' 'A-Z')
|
||||
OY=$(echo $OY | tr 'a-z' 'A-Z')
|
||||
OX=$OX" "$OY
|
||||
|
||||
#Debug "$OX"
|
||||
#Debug "$OY"
|
||||
|
||||
COPS="-"
|
||||
COPS_MCC="-"
|
||||
COPS_MNC="-"
|
||||
COPSX=$(echo $OXx | grep -o "+COPS: [01],0,.\+," | cut -d, -f3 | grep -o "[^\"]\+")
|
||||
|
||||
if [ "x$COPSX" != "x" ]; then
|
||||
COPS=$COPSX
|
||||
fi
|
||||
|
||||
COPSX=$(echo $OX | grep -o "+COPS: [01],2,.\+," | cut -d, -f3 | grep -o "[^\"]\+")
|
||||
|
||||
if [ "x$COPSX" != "x" ]; then
|
||||
COPS_MCC=${COPSX:0:3}
|
||||
COPS_MNC=${COPSX:3:3}
|
||||
if [ "$COPS" = "-" ]; then
|
||||
COPS=$(awk -F[\;] '/'$COPS'/ {print $2}' $ROOTER/signal/mccmnc.data)
|
||||
[ "x$COPS" = "x" ] && COPS="-"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$COPS" = "-" ]; then
|
||||
COPS=$(echo "$O" | awk -F[\"] '/^\+COPS: 0,0/ {print $2}')
|
||||
if [ "x$COPS" = "x" ]; then
|
||||
COPS="-"
|
||||
COPS_MCC="-"
|
||||
COPS_MNC="-"
|
||||
fi
|
||||
fi
|
||||
COPS_MNC=" "$COPS_MNC
|
||||
|
||||
OX=$(echo "${OX//[ \"]/}")
|
||||
CID=""
|
||||
CID5=""
|
||||
RAT=""
|
||||
REGV=$(echo "$OX" | grep -o "+C5GREG:2,[0-9],[A-F0-9]\{2,6\},[A-F0-9]\{5,10\},[0-9]\{1,2\}")
|
||||
if [ -n "$REGV" ]; then
|
||||
LAC5=$(echo "$REGV" | cut -d, -f3)
|
||||
LAC5=$LAC5" ($(printf "%d" 0x$LAC5))"
|
||||
CID5=$(echo "$REGV" | cut -d, -f4)
|
||||
CID5L=$(printf "%010X" 0x$CID5)
|
||||
RNC5=${CID5L:1:6}
|
||||
RNC5=$RNC5" ($(printf "%d" 0x$RNC5))"
|
||||
CID5=${CID5L:7:3}
|
||||
CID5="Short $(printf "%X" 0x$CID5) ($(printf "%d" 0x$CID5)), Long $(printf "%X" 0x$CID5L) ($(printf "%d" 0x$CID5L))"
|
||||
RAT=$(echo "$REGV" | cut -d, -f5)
|
||||
fi
|
||||
REGV=$(echo "$OX" | grep -o "+CEREG:2,[0-9],[A-F0-9]\{2,4\},[A-F0-9]\{5,8\}")
|
||||
REGFMT="3GPP"
|
||||
if [ -z "$REGV" ]; then
|
||||
REGV=$(echo "$OX" | grep -o "+CEREG:2,[0-9],[A-F0-9]\{2,4\},[A-F0-9]\{1,3\},[A-F0-9]\{5,8\}")
|
||||
REGFMT="SW"
|
||||
fi
|
||||
if [ -n "$REGV" ]; then
|
||||
LAC=$(echo "$REGV" | cut -d, -f3)
|
||||
LAC=$(printf "%04X" 0x$LAC)" ($(printf "%d" 0x$LAC))"
|
||||
if [ $REGFMT = "3GPP" ]; then
|
||||
CID=$(echo "$REGV" | cut -d, -f4)
|
||||
else
|
||||
CID=$(echo "$REGV" | cut -d, -f5)
|
||||
fi
|
||||
CIDL=$(printf "%08X" 0x$CID)
|
||||
RNC=${CIDL:1:5}
|
||||
RNC=$RNC" ($(printf "%d" 0x$RNC))"
|
||||
CID=${CIDL:6:2}
|
||||
CID="Short $(printf "%X" 0x$CID) ($(printf "%d" 0x$CID)), Long $(printf "%X" 0x$CIDL) ($(printf "%d" 0x$CIDL))"
|
||||
|
||||
else
|
||||
REGV=$(echo "$OX" | grep -o "+CREG:2,[0-9],[A-F0-9]\{2,4\},[A-F0-9]\{2,8\}")
|
||||
if [ -n "$REGV" ]; then
|
||||
LAC=$(echo "$REGV" | cut -d, -f3)
|
||||
CID=$(echo "$REGV" | cut -d, -f4)
|
||||
if [ ${#CID} -gt 4 ]; then
|
||||
LAC=$(printf "%04X" 0x$LAC)" ($(printf "%d" 0x$LAC))"
|
||||
CIDL=$(printf "%08X" 0x$CID)
|
||||
RNC=${CIDL:1:3}
|
||||
CID=${CIDL:4:4}
|
||||
CID="Short $(printf "%X" 0x$CID) ($(printf "%d" 0x$CID)), Long $(printf "%X" 0x$CIDL) ($(printf "%d" 0x$CIDL))"
|
||||
else
|
||||
LAC=""
|
||||
fi
|
||||
else
|
||||
LAC=""
|
||||
fi
|
||||
fi
|
||||
REGSTAT=$(echo "$REGV" | cut -d, -f2)
|
||||
if [ "$REGSTAT" == "5" -a "$COPS" != "-" ]; then
|
||||
COPS_MNC=$COPS_MNC" (Roaming)"
|
||||
fi
|
||||
if [ -n "$CID" -a -n "$CID5" ] && [ "$RAT" == "13" -o "$RAT" == "10" ]; then
|
||||
LAC="4G $LAC, 5G $LAC5"
|
||||
CID="4G $CID<br />5G $CID5"
|
||||
RNC="4G $RNC, 5G $RNC5"
|
||||
elif [ -n "$CID5" ]; then
|
||||
LAC=$LAC5
|
||||
CID=$CID5
|
||||
RNC=$RNC5
|
||||
fi
|
||||
if [ -z "$LAC" ]; then
|
||||
LAC="-"
|
||||
CID="-"
|
||||
RNC="-"
|
||||
fi
|
||||
}
|
||||
|
||||
#Quectel��˾���һ�վAT
|
||||
Quectel_AT()
|
||||
{
|
||||
Debug "Quectel_AT"
|
||||
ATPORT
|
||||
|
||||
Quectel_SIMINFO
|
||||
All_CSQ
|
||||
|
||||
Quectel_Cellinfo
|
||||
|
||||
#
|
||||
OX=$( sendat $ATPORT 'AT+QENG="servingcell"' | grep "+QENG:" )
|
||||
NR_NSA=$(echo $OX | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",")
|
||||
NR_SA=$(echo $OX | grep -o -i "+QENG: \"SERVINGCELL\",[^,]\+,\"NR5G-SA\",\"[DFT]\{3\}\",")
|
||||
if [ -n "$NR_NSA" ]; then
|
||||
QENG=",,"$(echo $OX" " | grep -o -i "+QENG: \"LTE\".\+\"NR5G-NSA\"," | tr " " ",")
|
||||
QENG5=$(echo $OX | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",[0-9]\{3\},[0-9]\{2,3\},[0-9]\{1,5\},-[0-9]\{2,5\},[-0-9]\{1,3\},-[0-9]\{2,3\},[0-9]\{1,7\},[0-9]\{1,3\}.\{1,6\}")
|
||||
if [ -z "$QENG5" ]; then
|
||||
QENG5=$(echo $OX | grep -o -i "+QENG:[ ]\?\"NR5G-NSA\",[0-9]\{3\},[0-9]\{2,3\},[0-9]\{1,5\},-[0-9]\{2,3\},[-0-9]\{1,3\},-[0-9]\{2,3\}")
|
||||
if [ -n "$QENG5" ]; then
|
||||
QENG5=$QENG5",,"
|
||||
fi
|
||||
fi
|
||||
elif [ -n "$NR_SA" ]; then
|
||||
QENG=$(echo $NR_SA | tr " " ",")
|
||||
QENG5=$(echo $OX | grep -o -i "+QENG: \"SERVINGCELL\",[^,]\+,\"NR5G-SA\",\"[DFT]\{3\}\",[ 0-9]\{3,4\},[0-9]\{2,3\},[0-9A-F]\{1,10\},[0-9]\{1,5\},[0-9A-F]\{2,6\},[0-9]\{6,7\},[0-9]\{1,3\},[0-9]\{1,2\},-[0-9]\{2,5\},-[0-9]\{2,3\},[-0-9]\{1,3\}")
|
||||
else
|
||||
QENG=$(echo $OX" " | grep -o -i "+QENG: [^ ]\+ " | tr " " ",")
|
||||
fi
|
||||
|
||||
|
||||
# Debug "$QENG"
|
||||
# Debug "$QENG5"
|
||||
|
||||
RAT=$(echo $QENG | cut -d, -f4 | grep -o "[-A-Z5]\{3,7\}")
|
||||
case $RAT in
|
||||
"GSM")
|
||||
MODE="GSM"
|
||||
;;
|
||||
"WCDMA")
|
||||
MODE="WCDMA"
|
||||
CHANNEL=$(echo $QENG | cut -d, -f9)
|
||||
RSCP=$(echo $QENG | cut -d, -f12)
|
||||
RSCP="-"$(echo $RSCP | grep -o "[0-9]\{1,3\}")
|
||||
ECIO=$(echo $QENG | cut -d, -f13)
|
||||
ECIO="-"$(echo $ECIO | grep -o "[0-9]\{1,3\}")
|
||||
;;
|
||||
"LTE"|"CAT-M"|"CAT-NB")
|
||||
MODE=$(echo $QENG | cut -d, -f5 | grep -o "[DFT]\{3\}")
|
||||
if [ -n "$MODE" ]; then
|
||||
MODE="$RAT $MODE"
|
||||
else
|
||||
MODE="$RAT"
|
||||
fi
|
||||
PCI=$(echo $QENG | cut -d, -f9)
|
||||
CHANNEL=$(echo $QENG | cut -d, -f10)
|
||||
LBAND=$(echo $QENG | cut -d, -f11 | grep -o "[0-9]\{1,3\}")
|
||||
BW=$(echo $QENG | cut -d, -f12)
|
||||
lte_bw
|
||||
BWU=$BW
|
||||
BW=$(echo $QENG | cut -d, -f13)
|
||||
lte_bw
|
||||
BWD=$BW
|
||||
if [ -z "$BWD" ]; then
|
||||
BWD="unknown"
|
||||
fi
|
||||
if [ -z "$BWU" ]; then
|
||||
BWU="unknown"
|
||||
fi
|
||||
if [ -n "$LBAND" ]; then
|
||||
LBAND="B"$LBAND" (Bandwidth $BWD MHz Down | $BWU MHz Up)"
|
||||
fi
|
||||
RSRP=$(echo $QENG | cut -d, -f15 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$RSRP" ]; then
|
||||
RSCP="-"$RSRP
|
||||
RSRPLTE=$RSCP
|
||||
fi
|
||||
RSRQ=$(echo $QENG | cut -d, -f16 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$RSRQ" ]; then
|
||||
ECIO="-"$RSRQ
|
||||
fi
|
||||
RSSI=$(echo $QENG | cut -d, -f17 | grep -o "\-[0-9]\{1,3\}")
|
||||
if [ -n "$RSSI" ]; then
|
||||
CSQ_RSSI=$RSSI" dBm"
|
||||
fi
|
||||
SINRR=$(echo $QENG | cut -d, -f18 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 25 ]; then
|
||||
SINR=$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$NR_NSA" ]; then
|
||||
MODE="LTE/NR EN-DC"
|
||||
echo "0" > /tmp/modnetwork
|
||||
if [ -n "$QENG5" ] && [ -n "$LBAND" ] && [ "$RSCP" != "-" ] && [ "$ECIO" != "-" ]; then
|
||||
PCI="$PCI, "$(echo $QENG5 | cut -d, -f4)
|
||||
SCHV=$(echo $QENG5 | cut -d, -f8)
|
||||
SLBV=$(echo $QENG5 | cut -d, -f9)
|
||||
BW=$(echo $QENG5 | cut -d, -f10 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SLBV" ]; then
|
||||
LBAND=$LBAND"<br />n"$SLBV
|
||||
if [ -n "$BW" ]; then
|
||||
nr_bw
|
||||
LBAND=$LBAND" (Bandwidth $BW MHz)"
|
||||
fi
|
||||
if [ "$SCHV" -ge 123400 ]; then
|
||||
CHANNEL=$CHANNEL", "$SCHV
|
||||
else
|
||||
CHANNEL=$CHANNEL", -"
|
||||
fi
|
||||
else
|
||||
LBAND=$LBAND"<br />nxx (unknown NR5G band)"
|
||||
CHANNEL=$CHANNEL", -"
|
||||
fi
|
||||
RSCP=$RSCP" dBm<br />"$(echo $QENG5 | cut -d, -f5)
|
||||
SINRR=$(echo $QENG5 | cut -d, -f6 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 30 ]; then
|
||||
SINR=$SINR"<br />"$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
ECIO=$ECIO" (4G) dB<br />"$(echo $QENG5 | cut -d, -f7)" (5G) "
|
||||
fi
|
||||
fi
|
||||
if [ -z "$LBAND" ]; then
|
||||
LBAND="-"
|
||||
else
|
||||
if [ -n "$QCA" ]; then
|
||||
QCA=$(echo $QCA | grep -o "\"S[CS]\{2\}\"[-0-9A-Z,\"]\+")
|
||||
for QCAL in $(echo "$QCA"); do
|
||||
if [ $(echo "$QCAL" | cut -d, -f7) = "2" ]; then
|
||||
SCHV=$(echo $QCAL | cut -d, -f2 | grep -o "[0-9]\+")
|
||||
SRATP="B"
|
||||
if [ -n "$SCHV" ]; then
|
||||
CHANNEL="$CHANNEL, $SCHV"
|
||||
if [ "$SCHV" -gt 123400 ]; then
|
||||
SRATP="n"
|
||||
fi
|
||||
fi
|
||||
SLBV=$(echo $QCAL | cut -d, -f6 | grep -o "[0-9]\{1,2\}")
|
||||
if [ -n "$SLBV" ]; then
|
||||
LBAND=$LBAND"<br />"$SRATP$SLBV
|
||||
BWD=$(echo $QCAL | cut -d, -f3 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$BWD" ]; then
|
||||
UPDOWN=$(echo $QCAL | cut -d, -f13)
|
||||
case "$UPDOWN" in
|
||||
"UL" )
|
||||
CATYPE="CA"$(printf "\xe2\x86\x91") ;;
|
||||
"DL" )
|
||||
CATYPE="CA"$(printf "\xe2\x86\x93") ;;
|
||||
* )
|
||||
CATYPE="CA" ;;
|
||||
esac
|
||||
if [ $BWD -gt 14 ]; then
|
||||
LBAND=$LBAND" ("$CATYPE", Bandwidth "$(($(echo $BWD) / 5))" MHz)"
|
||||
else
|
||||
LBAND=$LBAND" ("$CATYPE", Bandwidth 1.4 MHz)"
|
||||
fi
|
||||
fi
|
||||
LBAND=$LBAND
|
||||
fi
|
||||
PCI="$PCI, "$(echo $QCAL | cut -d, -f8)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ $RAT = "CAT-M" ] || [ $RAT = "CAT-NB" ]; then
|
||||
LBAND="B$(echo $QENG | cut -d, -f11) ($RAT)"
|
||||
fi
|
||||
;;
|
||||
"NR5G-SA")
|
||||
MODE="NR5G-SA"
|
||||
if [ -n "$QENG5" ]; then
|
||||
#AT+qnwcfg="NR5G_AMBR" #��ѯ�ٶ�
|
||||
MODE="$RAT $(echo $QENG5 | cut -d, -f4)"
|
||||
PCI=$(echo $QENG5 | cut -d, -f8)
|
||||
CHANNEL=$(echo $QENG5 | cut -d, -f10)
|
||||
LBAND=$(echo $QENG5 | cut -d, -f11)
|
||||
BW=$(echo $QENG5 | cut -d, -f12)
|
||||
nr_bw
|
||||
LBAND="n"$LBAND" (Bandwidth $BW MHz)"
|
||||
RSCP=$(echo $QENG5 | cut -d, -f13)
|
||||
ECIO=$(echo $QENG5 | cut -d, -f14)
|
||||
if [ "$CSQ_PER" = "-" ]; then
|
||||
RSSI=$(rsrp2rssi $RSCP $BW)
|
||||
CSQ_PER=$((100 - (($RSSI + 51) * 100/-62)))"%"
|
||||
CSQ=$((($RSSI + 113) / 2))
|
||||
CSQ_RSSI=$RSSI" dBm"
|
||||
fi
|
||||
SINRR=$(echo $QENG5 | cut -d, -f15 | grep -o "[0-9]\{1,3\}")
|
||||
if [ -n "$SINRR" ]; then
|
||||
if [ $SINRR -le 30 ]; then
|
||||
SINR=$((($(echo $SINRR) * 2) -20))" dB"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
OX=$( sendat $ATPORT "AT+QCAINFO" | grep "+QCAINFO:" )
|
||||
QCA=$(echo $OX" " | grep -o -i "+QCAINFO: \"S[CS]\{2\}\".\+NWSCANMODE" | tr " " ",")
|
||||
|
||||
|
||||
#
|
||||
OX=$( sendat $ATPORT 'AT+QCFG="nwscanmode"' | grep "+QCAINFO:" )
|
||||
QNSM=$(echo $OX | grep -o -i "+QCFG: \"NWSCANMODE\",[0-9]")
|
||||
QNSM=$(echo "$QNSM" | grep -o "[0-9]")
|
||||
if [ -n "$QNSM" ]; then
|
||||
MODTYPE="6"
|
||||
case $QNSM in
|
||||
"0" )
|
||||
NETMODE="1" ;;
|
||||
"1" )
|
||||
NETMODE="3" ;;
|
||||
"2"|"5" )
|
||||
NETMODE="5" ;;
|
||||
"3" )
|
||||
NETMODE="7" ;;
|
||||
esac
|
||||
fi
|
||||
if [ -n "$QNWP" ]; then
|
||||
MODTYPE="6"
|
||||
case $QNWP in
|
||||
"AUTO" )
|
||||
NETMODE="1" ;;
|
||||
"WCDMA" )
|
||||
NETMODE="5" ;;
|
||||
"LTE" )
|
||||
NETMODE="7" ;;
|
||||
"LTE:NR5G" )
|
||||
NETMODE="8" ;;
|
||||
"NR5G" )
|
||||
NETMODE="9" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
OX=$( sendat $ATPORT 'AT+QNWPREFCFG="mode_pref"' | grep "+QNWPREFCFG:" )
|
||||
QNWP=$(echo $OX | grep -o -i "+QNWPREFCFG: \"MODE_PREF\",[A-Z5:]\+" | cut -d, -f2)
|
||||
|
||||
#�¶�
|
||||
OX=$( sendat $ATPORT 'AT+QTEMP' | grep "+QTEMP:" )
|
||||
QTEMP=$(echo $OX | grep -o -i "+QTEMP: [0-9]\{1,3\}")
|
||||
if [ -z "$QTEMP" ]; then
|
||||
QTEMP=$(echo $OX | grep -o -i "+QTEMP:[ ]\?\"XO[_-]THERM[_-][^,]\+,[\"]\?[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}")
|
||||
fi
|
||||
if [ -z "$QTEMP" ]; then
|
||||
QTEMP=$(echo $OX | grep -o -i "+QTEMP:[ ]\?\"MDM-CORE-USR.\+[0-9]\{1,3\}\"" | cut -d\" -f4)
|
||||
fi
|
||||
if [ -z "$QTEMP" ]; then
|
||||
QTEMP=$(echo $OX | grep -o -i "+QTEMP:[ ]\?\"MDMSS.\+[0-9]\{1,3\}\"" | cut -d\" -f4)
|
||||
fi
|
||||
if [ -n "$QTEMP" ]; then
|
||||
CTEMP=$(echo $QTEMP | grep -o -i "[0-9]\{1,3\}")$(printf "\xc2\xb0")"C"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
OX=$( sendat $ATPORT "AT+QRSRP" | grep "+QRSRP:" )
|
||||
QRSRP=$(echo "$OX" | grep -o -i "+QRSRP:[^,]\+,-[0-9]\{1,5\},-[0-9]\{1,5\},-[0-9]\{1,5\}[^ ]*")
|
||||
if [ -n "$QRSRP" ] && [ "$RAT" != "WCDMA" ]; then
|
||||
QRSRP1=$(echo $QRSRP | cut -d, -f1 | grep -o "[-0-9]\+")
|
||||
QRSRP2=$(echo $QRSRP | cut -d, -f2)
|
||||
QRSRP3=$(echo $QRSRP | cut -d, -f3)
|
||||
QRSRP4=$(echo $QRSRP | cut -d, -f4)
|
||||
QRSRPtype=$(echo $QRSRP | cut -d, -f5)
|
||||
if [ "$QRSRPtype" == "NR5G" ]; then
|
||||
if [ -n "$NR_SA" ]; then
|
||||
RSCP=$QRSRP1
|
||||
if [ -n "$QRPRP2" -a "$QRSRP2" != "-32768" ]; then
|
||||
RSCP1="RxD "$QRSRP2
|
||||
fi
|
||||
if [ -n "$QRSRP3" -a "$QRSRP3" != "-32768" ]; then
|
||||
RSCP=$RSCP" dBm<br />"$QRSRP3
|
||||
fi
|
||||
if [ -n "$QRSRP4" -a "$QRSRP4" != "-32768" ]; then
|
||||
RSCP1="RxD "$QRSRP4
|
||||
fi
|
||||
else
|
||||
RSCP=$RSRPLTE
|
||||
if [ -n "$QRSRP1" -a "$QRSRP1" != "-32768" ]; then
|
||||
RSCP=$RSCP" (4G) dBm<br />"$QRSRP1
|
||||
if [ -n "$QRSRP2" -a "$QRSRP2" != "-32768" ]; then
|
||||
RSCP="$RSCP,$QRSRP2"
|
||||
if [ -n "$QRSRP3" -a "$QRSRP3" != "-32768" ]; then
|
||||
RSCP="$RSCP,$QRSRP3"
|
||||
if [ -n "$QRSRP4" -a "$QRSRP4" != "-32768" ]; then
|
||||
RSCP="$RSCP,$QRSRP4"
|
||||
fi
|
||||
fi
|
||||
RSCP=$RSCP" (5G) "
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
elif [ "$QRSRP2$QRSRP3$QRSRP4" != "-44-44-44" -a -z "$QENG5" ]; then
|
||||
RSCP=$QRSRP1
|
||||
if [ "$QRSRP3$QRSRP4" == "-140-140" -o "$QRSRP3$QRSRP4" == "-44-44" -o "$QRSRP3$QRSRP4" == "-32768-32768" ]; then
|
||||
RSCP1="RxD "$(echo $QRSRP | cut -d, -f2)
|
||||
else
|
||||
RSCP=$RSCP" dBm (RxD "$QRSRP2" dBm)<br />"$QRSRP3
|
||||
RSCP1="RxD "$QRSRP4
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# 将 $2 中的所有单引号替换为双引号
|
||||
|
||||
# 发送处理后的命令
|
||||
rec=$(sendat $1 $2)
|
||||
|
||||
# 将结果写入文件
|
||||
echo "$rec" >> /tmp/result.at
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
en=1 #调试开关:0关闭,1打开 ,2输出到文件
|
||||
outfile="/tmp/cpe.log" #输出文件
|
||||
#日志信息
|
||||
Debug() {
|
||||
tim=$(date "+%Y-%m-%d %H:%M:%S") # 获取系统时间
|
||||
if [ "$en" -eq 1 ]; then
|
||||
echo "$tim $1" # 打印输出
|
||||
elif [ "$en" -eq 2 ]; then
|
||||
echo "$tim $1" >> "$outfile" # 输出到文件
|
||||
fi
|
||||
}
|
||||
|
||||
ATPORT()
|
||||
{
|
||||
MODEMNAME="ALL"
|
||||
ATPORT=2
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
rm -f /tmp/result.at
|
||||
@@ -0,0 +1,332 @@
|
||||
#!/bin/sh
|
||||
source /usr/share/cpe/cpedebug
|
||||
#source /usr/share/cpe/SIMCOM
|
||||
source /usr/share/cpe/Quectel
|
||||
#source /usr/share/cpe/Fibocom
|
||||
|
||||
#初值化数据结构
|
||||
InitData()
|
||||
{
|
||||
Date=''
|
||||
CHANNEL="-"
|
||||
ECIO="-"
|
||||
RSCP="-"
|
||||
ECIO1=" "
|
||||
RSCP1=" "
|
||||
NETMODE="-"
|
||||
LBAND="-"
|
||||
PCI="-"
|
||||
CTEMP="-"
|
||||
MODE="-"
|
||||
SINR="-"
|
||||
IMEI='-'
|
||||
IMSI='-'
|
||||
ICCID='-'
|
||||
phone='-'
|
||||
conntype=''
|
||||
Model=''
|
||||
|
||||
|
||||
}
|
||||
#写数据
|
||||
SETData()
|
||||
{
|
||||
{
|
||||
echo $Model #'RM520N-GL'
|
||||
echo $conntype #'conntype'
|
||||
echo $quectel_device_id
|
||||
echo $COPS #运营商
|
||||
echo 'ttyUSB2' #端口
|
||||
echo $CTEMP #温度
|
||||
echo 'QMI' #协议
|
||||
echo '---------------------------------'
|
||||
echo $IMEI #imei
|
||||
echo $IMSI #imsi
|
||||
echo $ICCID #iccid
|
||||
echo $phone #phone
|
||||
echo '---------------------------------'
|
||||
|
||||
echo $MODE
|
||||
echo $CSQ
|
||||
echo $CSQ_PER
|
||||
echo $CSQ_RSSI
|
||||
echo $ECIO #参考信号接收质量 RSRQ ecio
|
||||
echo $ECIO1 #参考信号接收质量 RSRQ ecio1
|
||||
echo $RSCP #参考信号接收功率 RSRP rscp0
|
||||
echo $RSCP1 #参考信号接收功率 RSRP rscp1
|
||||
echo $SINR #信噪比 SINR rv["sinr"]
|
||||
echo $NETMODE #连接状态监控 rv["netmode"]
|
||||
echo '---------------------------------'
|
||||
|
||||
|
||||
echo $COPS_MCC #MCC
|
||||
echo $$COPS_MNC #MNC
|
||||
echo $LAC #eNB ID
|
||||
echo '' #LAC_NUM
|
||||
echo $RNC #TAC
|
||||
echo '' #RNC_NUM
|
||||
echo $CID
|
||||
echo '' #CID_NUM
|
||||
echo $LBAND
|
||||
echo $CHANNEL
|
||||
echo $PCI
|
||||
|
||||
echo $Date
|
||||
|
||||
|
||||
|
||||
echo $MODTYPE
|
||||
echo $QTEMP
|
||||
|
||||
} > /tmp/cpe_cell.file
|
||||
}
|
||||
|
||||
|
||||
|
||||
ATPORT=2
|
||||
|
||||
# 自动处理模块信号
|
||||
AUTO_CPE() {
|
||||
Debug "------------------------------端口$ATPORT---------------------------"
|
||||
Debug "AUTO_CPE"
|
||||
Date=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
quectel_device_id=$(lsusb | grep -i "Quectel" | awk '{print $6}')
|
||||
Debug "Quectel 设备 ID: $quectel_device_id"
|
||||
# 检测设备是否准备好
|
||||
if sendat $ATPORT "AT" 500 | grep -q "OK"; then
|
||||
sleep 1s
|
||||
else
|
||||
Debug "设备未准备好"
|
||||
sleep 5s
|
||||
return
|
||||
fi
|
||||
|
||||
Debug "读取模块信息 计算模块"
|
||||
ATATI=$(sendat $ATPORT "ATI")
|
||||
Getconntype=$(echo "$ATATI" | sed -n '2p')
|
||||
|
||||
if [ -z "$Getconntype" ]; then
|
||||
Debug "无法获取模块类型"
|
||||
sleep 5s
|
||||
return
|
||||
fi
|
||||
|
||||
conntype=$Getconntype
|
||||
Model=$(echo "$ATATI" | sed -n '3p')
|
||||
|
||||
# 检查 SIM 卡状态
|
||||
cpin=$(sendat $ATPORT "at+cpin?")
|
||||
if echo "$cpin" | grep -q "ERROR"; then
|
||||
Debug "No SIM or SIM Error"
|
||||
sleep 5s
|
||||
return
|
||||
elif ! echo "$cpin" | grep -q "READY"; then
|
||||
Debug "SIM Locked or Not Ready"
|
||||
sleep 5s
|
||||
return
|
||||
else
|
||||
Debug "SIM Ready"
|
||||
fi
|
||||
|
||||
# 根据模块类型执行相应命令或设置不支持的模块消息
|
||||
if echo $conntype | grep -qi "Quectel"; then
|
||||
Quectel_AT
|
||||
else
|
||||
Debug "$Model"
|
||||
fi
|
||||
}
|
||||
|
||||
#重新联网
|
||||
modem_reset() {
|
||||
echo "Abnormal network restart"
|
||||
|
||||
# 停止 modem 服务
|
||||
/etc/init.d/modem stop || echo "Failed to stop modem service."
|
||||
killall quectel-CM
|
||||
# 发送 AT 命令重置 modem
|
||||
sendat $ATPORT "AT+CFUN=1,1" || echo "Failed to send AT+CFUN=1,1 command."
|
||||
|
||||
# 等待 modem 重置
|
||||
sleep 10s
|
||||
|
||||
# 无限循环,直到检测到 Quectel 设备
|
||||
while true; do
|
||||
if lsusb | grep -qi "Quectel"; then
|
||||
echo "Quectel device detected."
|
||||
# 启动 modem 服务
|
||||
sleep 8s
|
||||
/etc/init.d/modem start || echo "Failed to start modem service."
|
||||
break # 检测到设备后跳出循环
|
||||
else
|
||||
echo "Waiting for Quectel device..."
|
||||
sleep 1s # 等待 1 秒后再次检测
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#检测SIM卡是否插入,10次检测不到则重启模块
|
||||
check_sim() {
|
||||
while true; do
|
||||
enabled=$(uci -q get modem.@ndis[0].enabled)
|
||||
if [ "$enabled" -eq 1 ]; then
|
||||
echo "Check the sim"
|
||||
rec=$(sendat 2 "AT+CPIN?")
|
||||
rec1=$(echo "$rec" | grep -c "READY")
|
||||
if [ $rec1 -eq 1 ]; then
|
||||
x=0
|
||||
echo "SIM is READY"
|
||||
else
|
||||
x=$((x + 1))
|
||||
if [ $x -eq 10 ]; then
|
||||
echo "SIM abnormal restart"
|
||||
modem_reset || echo "Failed to reset modem after SIM abnormality."
|
||||
x=0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
sleep 6s
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#检测网络状态第一次开机
|
||||
check_firstdns() {
|
||||
while true; do
|
||||
enabled=$(uci -q get modem.@ndis[0].enabled)
|
||||
en1=$(uci -q get modem.@ndis[0].en)
|
||||
if [ "$enabled" -eq 1 ] && [ "$en1" -eq 1 ]; then
|
||||
echo "------------------------------开启任务---------------------------"
|
||||
urls="http://wifi.vivo.com.cn/generate_204 http://www.gstatic.com/generate_204"
|
||||
success=0
|
||||
for url in $urls; do
|
||||
if curl -4 --interface wwan0 -I "$url" 2>/dev/null | grep -q "HTTP/.* 204"; then
|
||||
echo "网络连接正常"
|
||||
success=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $success -eq 1 ]; then
|
||||
echo "网络连接正常"
|
||||
xx=0
|
||||
return
|
||||
else
|
||||
echo "网络连接异常"
|
||||
xx=$((xx + 1))
|
||||
if [ $xx -eq 5 ]; then
|
||||
echo "Attempting to reset modem due to network connection issue."
|
||||
modem_reset || echo "Failed to reset modem."
|
||||
xx=0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "------------------------------结束任务---------------------------"
|
||||
fi
|
||||
sleep 1s
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
#检测网络状态
|
||||
check_dns() {
|
||||
en1=$(uci -q get modem.@ndis[0].en)
|
||||
if [ "$en1" = '1' ]; then
|
||||
echo "------------------------------开启任务---------------------------"
|
||||
# 使用 curl 检查 HTTP 状态码
|
||||
urls="http://wifi.vivo.com.cn/generate_204 http://www.gstatic.com/generate_204"
|
||||
success=0
|
||||
for url in $urls; do
|
||||
if curl -4 --interface wwan0 -I "$url" 2>/dev/null | grep -q "HTTP/.* 204"; then
|
||||
echo "网络连接正常"
|
||||
success=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $success -eq 0 ]; then
|
||||
echo "网络连接异常"
|
||||
xx=$((xx + 1))
|
||||
if [ $xx -eq $(uci -q get modem.@ndis[0].an) ]; then
|
||||
xx=0
|
||||
modem_reset || echo "Modem reset failed."
|
||||
fi
|
||||
fi
|
||||
echo "------------------------------结束任务---------------------------"
|
||||
fi
|
||||
}
|
||||
|
||||
check_Task() {
|
||||
while true; do
|
||||
enabled=$(uci -q get modem.@ndis[0].enabled)
|
||||
if [ "$enabled" = '1' ]; then
|
||||
Debug "------------------------------开启任务---------------------------"
|
||||
ATPORT || Debug "Failed to execute ATPORT."
|
||||
AUTO_CPE || Debug "Failed to execute AUTO_CPE."
|
||||
SETData || Debug "Failed to execute SETData."
|
||||
check_dns || Debug "Failed to execute check_dns."
|
||||
Debug "------------------------------结束任务---------------------------"
|
||||
fi
|
||||
sleep 5s
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#注册网卡
|
||||
RegisterNetwork()
|
||||
{
|
||||
Debug "RegisterNetwork 注册网卡 $MODEMNAME"
|
||||
|
||||
# 设置 wwan5g 网络
|
||||
if [ "$(uci -q get network.wwan5g.interface)" != "interface" ]; then
|
||||
uci set network.wwan5g=interface
|
||||
uci set network.wwan5g.device='wwan0'
|
||||
uci set network.wwan5g.proto=dhcp
|
||||
uci commit network
|
||||
uci set firewall.@zone[1].network="wan wan6 wwan5g wwan5g6 wlan"
|
||||
uci commit firewall
|
||||
/etc/init.d/network reload
|
||||
fi
|
||||
|
||||
# 设置 wwan5g6 网络
|
||||
if [ "$(uci -q get network.wwan5g6.interface)" != "interface" ]; then
|
||||
uci set network.wwan5g6=interface
|
||||
uci set network.wwan5g6.device='wwan0'
|
||||
uci set network.wwan5g6.proto='dhcpv6'
|
||||
uci set network.wwan5g6.reqaddress='try'
|
||||
uci set network.wwan5g6.reqprefix='auto'
|
||||
uci set network.wwan5g6._orig_bridge='false'
|
||||
uci set network.wwan5g6.extendprefix='1'
|
||||
uci commit network
|
||||
uci set firewall.@zone[1].network="wan wan6 wwan wwan5g wwan5g6 wlan"
|
||||
uci commit firewall
|
||||
/etc/init.d/network reload
|
||||
fi
|
||||
|
||||
# 更新 wwan5g 和 wwan5g6 接口名称
|
||||
for iface in wwan5g wwan5g6; do
|
||||
if [ "$(uci -q get network.$iface.device)" != "wwan0" ]; then
|
||||
uci set network.$iface.device='wwan0'
|
||||
uci commit network
|
||||
/etc/init.d/network reload
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
first() {
|
||||
Debug "开启RSSI服务"
|
||||
InitData
|
||||
Debug "初始化数据完成"
|
||||
sleep 1s
|
||||
ATPORT
|
||||
RegisterNetwork
|
||||
AUTO_CPE
|
||||
SETData
|
||||
modem_reset
|
||||
check_firstdns
|
||||
check_Task
|
||||
}
|
||||
|
||||
first
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-hypercpe": {
|
||||
"description": "Grant UCI access for luci-app-hypercpe",
|
||||
"read": {
|
||||
"uci": [ "modem" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "modem" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user