update 2024-04-02 23:52:01
674
luci-app-3ginfo-lite/LICENSE
Normal file
@ -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>.
|
19
luci-app-3ginfo-lite/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright 2021-2023 Rafał Wabik - IceG - From eko.one.pl forum
|
||||
#
|
||||
# Licensed to the GNU General Public License v3.0.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-3ginfo-lite
|
||||
LUCI_TITLE:=LuCI JS Support for 3ginfo-lite
|
||||
MAINTAINER:=Rafał Wabik <4Rafal@gmail.com>
|
||||
LUCI_DESCRIPTION:=LuCI JS interface for the 3ginfo-lite. The package allows you to view the parameters of the mobile internet connection.
|
||||
LUCI_DEPENDS:=+sms-tool +comgt +kmod-usb-serial-option
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0.58-20231021
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 8.3 KiB |
@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
'require form';
|
||||
'require fs';
|
||||
'require view';
|
||||
'require uci';
|
||||
'require ui';
|
||||
'require tools.widgets as widgets'
|
||||
|
||||
/*
|
||||
Copyright 2021-2023 Rafał Wabik - IceG - From eko.one.pl forum
|
||||
|
||||
Licensed to the GNU General Public License v3.0.
|
||||
*/
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return fs.list('/dev').then(function(devs) {
|
||||
return devs.filter(function(dev) {
|
||||
return dev.name.match(/^ttyUSB/) || dev.name.match(/^cdc-wdm/) || dev.name.match(/^ttyACM/) || dev.name.match(/^mhi_/);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
render: function(devs) {
|
||||
var m, s, o;
|
||||
m = new form.Map('3ginfo', _('Configuration 3ginfo-lite'), _('Configuration panel for the 3ginfo-lite application.'));
|
||||
|
||||
s = m.section(form.GridSection, '3ginfo');
|
||||
s.addremove = false;
|
||||
s.anonymous = false;
|
||||
s.nodescriptions = true;
|
||||
|
||||
o = s.option(widgets.NetworkSelect, 'network', _('Network'),
|
||||
_('Network interface for Internet access.')
|
||||
);
|
||||
o.noaliases = false;
|
||||
o.default = 'wan';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'device',
|
||||
_('IP adress / Port for communication with the modem'),
|
||||
_("Select the appropriate settings. <br /> \
|
||||
<br />Traditional modem. <br /> \
|
||||
Select one of the available ttyUSBX ports.<br /> \
|
||||
<br />HiLink modem. <br /> \
|
||||
Enter the IP address 192.168.X.X under which the modem is available."));
|
||||
devs.sort((a, b) => a.name > b.name);
|
||||
devs.forEach(dev => o.value('/dev/' + dev.name));
|
||||
o.placeholder = _('Please select a port');
|
||||
o.rmempty = false
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
@ -0,0 +1,113 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require dom';
|
||||
'require fs';
|
||||
'require ui';
|
||||
'require uci';
|
||||
'require network';
|
||||
|
||||
return view.extend({
|
||||
handleCommand: function(exec, args) {
|
||||
var buttons = document.querySelectorAll('.diag-action > .cbi-button');
|
||||
|
||||
for (var i = 0; i < buttons.length; i++)
|
||||
buttons[i].setAttribute('disabled', 'true');
|
||||
|
||||
return fs.exec(exec, args).then(function(res) {
|
||||
var out = document.querySelector('textarea');
|
||||
|
||||
dom.content(out, [res.stdout || '', res.stderr || '']);
|
||||
}).catch(function(err) {
|
||||
ui.addNotification(null, E('p', [err]))
|
||||
}).finally(function() {
|
||||
for (var i = 0; i < buttons.length; i++)
|
||||
buttons[i].removeAttribute('disabled');
|
||||
});
|
||||
},
|
||||
|
||||
handleAT: function(ev, path) {
|
||||
var exec = 'sms_tool',
|
||||
atcmd = ev.currentTarget.parentNode.previousSibling.value,
|
||||
args = ['-d', path, 'at', atcmd];
|
||||
|
||||
console.log("path=" + path);
|
||||
console.log("atcmd=" + atcmd);
|
||||
return this.handleCommand(exec, args);
|
||||
},
|
||||
|
||||
load: function() {
|
||||
return fs.list('/dev').then(function(devs) {
|
||||
return devs.filter(function(dev) {
|
||||
return dev.name.match(/^ttyUSB/) || dev.name.match(/^cdc-wdm/) || dev.name.match(/^ttyACM/) || dev.name.match(/^mhi_/);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
render: function(devs) {
|
||||
var text = 'Check signal strength > AT+CSQ\nGet the temperature of MT > AT+QTEMP\nCurrent band in use > AT+QNWINFO\nCarrier Agregation Info > AT+QCAINFO\nSIM Preferred Message Storage > AT+CPMS="SM","SM","SM"\nSave SMS Settings > AT+CSAS\nReboot the modem > AT+CFUN=1,1\nReset the modem > AT+CFUN=1\nQMI/PPP/Default > AT+QCFG="usbnet",0\nECM > AT+QCFG="usbnet",1\nMBIM > AT+QCFG="usbnet",2\n4G-LTE only > AT+QCFG="nwscanmode",3,1\nWCDMA only > AT+QCFG="nwscanmode",2,1\nGSM only > AT+QCFG="nwscanmode",1,1\nScan all modes > AT+QCFG="nwscanmode",0,1';
|
||||
var devs_arr = {};
|
||||
var devs_cla = {};
|
||||
devs.sort((a, b) => a.name > b.name);
|
||||
devs.forEach(dev => devs_arr['/dev/' + dev.name] = 'Send AT command to ' + '/dev/' + dev.name);
|
||||
devs.forEach(dev => devs_cla['/dev/' + dev.name] = 'btn cbi-button cbi-button-action');
|
||||
//console.log(devs_arr);
|
||||
var table = E('table', {
|
||||
'class': 'table'
|
||||
}, [
|
||||
E('tr', {
|
||||
'class': 'tr'
|
||||
}, [
|
||||
E('td', {
|
||||
'class': 'td left',
|
||||
'style': 'overflow:initial'
|
||||
}, [
|
||||
E('input', {
|
||||
'style': 'margin:5px 0',
|
||||
'type': 'text',
|
||||
'value': 'ATI'
|
||||
}),
|
||||
E('span', {
|
||||
'class': 'diag-action'
|
||||
}, [
|
||||
new ui.ComboButton('/dev/ttyUSB2', devs_arr, {
|
||||
'click': ui.createHandlerFn(this, 'handleAT'),
|
||||
'classes': devs_cla,
|
||||
}).render()
|
||||
])
|
||||
]),
|
||||
])
|
||||
]);
|
||||
|
||||
var view = E('div', {
|
||||
'class': 'cbi-map'
|
||||
}, [
|
||||
E('h2', {}, [_('Send AT command:')]),
|
||||
E('div', {
|
||||
'class': 'cbi-map-descr'
|
||||
}, _('Sending AT command to selected device com port.')),
|
||||
table,
|
||||
E('div', {
|
||||
'class': 'cbi-section'
|
||||
}, [
|
||||
E('div', {
|
||||
'id': 'command-output'
|
||||
},
|
||||
E('textarea', {
|
||||
'id': 'widget.command-output',
|
||||
'style': 'width: 100%; font-family:monospace; white-space:pre',
|
||||
'readonly': true,
|
||||
'wrap': 'off',
|
||||
'rows': '20',
|
||||
'placeholder': text,
|
||||
})
|
||||
)
|
||||
])
|
||||
]);
|
||||
|
||||
return view;
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
154
luci-app-3ginfo-lite/po/de/3ginfo.po
Normal file
@ -0,0 +1,154 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "Information about 3G/4G/5G connection"
|
||||
msgstr "Informationen über die 3G/4G/5G-Verbindung"
|
||||
|
||||
msgid "More information about the 3ginfo on the %seko.one.pl forum%s."
|
||||
msgstr "Mehr informationen zu 3ginfo unter %sforum eko.one.pl%s."
|
||||
|
||||
msgid "eko.one.pl forum"
|
||||
msgstr "Forum eko.one.pl"
|
||||
|
||||
msgid "Details"
|
||||
msgstr "Details"
|
||||
|
||||
msgid "USB debug information"
|
||||
msgstr "USB-Debug-Informationen"
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr "Konfiguration"
|
||||
|
||||
msgid "General Information"
|
||||
msgstr "allgemeine Informationen"
|
||||
|
||||
msgid "Modem Information"
|
||||
msgstr "Modem Informationen"
|
||||
|
||||
msgid "Cell / Signal Information"
|
||||
msgstr "Zellen-/Signalinformationen"
|
||||
|
||||
msgid "Technology"
|
||||
msgstr "Technologie"
|
||||
|
||||
msgid "Operator"
|
||||
msgstr "Netzbetreiber"
|
||||
|
||||
msgid "Signal strength"
|
||||
msgstr "Signalstärke"
|
||||
|
||||
msgid "Connection statistics"
|
||||
msgstr "Verbindungsstatistik"
|
||||
|
||||
msgid "Modem type"
|
||||
msgstr "Modemtyp"
|
||||
|
||||
msgid "Additional information"
|
||||
msgstr "zusätzliche Informationen"
|
||||
|
||||
msgid "Revision / Firmware"
|
||||
msgstr "Revision / Firmware"
|
||||
|
||||
msgid "IP adress / Communication Port"
|
||||
msgstr "IP-Adresse / Verbindungsport"
|
||||
|
||||
msgid "Chip Temperature"
|
||||
msgstr "Chiptemperatur"
|
||||
|
||||
msgid "Configuration 3ginfo-lite"
|
||||
msgstr "Konfiguration 3ginfo-lite"
|
||||
|
||||
msgid "Configuration panel for the 3ginfo-lite application."
|
||||
msgstr "Konfigurationspanel für 3ginfo-lite."
|
||||
|
||||
msgid "Network"
|
||||
msgstr "Netzwerk"
|
||||
|
||||
msgid "IP adress / Port for communication with the modem"
|
||||
msgstr "IP-Adresse / Verbindungsport mit dem Modem"
|
||||
|
||||
msgid "Protocol"
|
||||
msgstr "Protokoll"
|
||||
|
||||
msgid ""
|
||||
"Select the appropriate settings. <br /> <br />Traditional "
|
||||
"modem. <br /> Select one of the available ttyUSBX "
|
||||
"ports.<br /> <br />HiLink modem. <br /> Enter the IP address "
|
||||
"192.168.X.X under which the modem is available."
|
||||
msgstr ""
|
||||
"Passende Einstellung wählen. <br /> <br />Traditionelles "
|
||||
"modem. <br /> Einen der verfügbaren ttyUSBX"
|
||||
"Port wählen.<br /> <br />MHiLink Modem. <br /> IP-Adresse wie"
|
||||
"192.168.X.X angeben, unter der das Modem erreichbar ist."
|
||||
|
||||
msgid "Very good"
|
||||
msgstr "Sehr gut"
|
||||
|
||||
msgid "Good"
|
||||
msgstr "Gut"
|
||||
|
||||
msgid "Weak"
|
||||
msgstr "Schwach"
|
||||
|
||||
msgid "Very weak"
|
||||
msgstr "Sehr schwach"
|
||||
|
||||
msgid "Excellent"
|
||||
msgstr "Exzellent"
|
||||
|
||||
msgid "Good"
|
||||
msgstr "Gut"
|
||||
|
||||
msgid "Mid cell"
|
||||
msgstr "Zellmitte"
|
||||
|
||||
msgid "Cell edge"
|
||||
msgstr "Zellrand"
|
||||
|
||||
msgid "SIM status"
|
||||
msgstr "SIM-Status"
|
||||
|
||||
msgid "Not registered"
|
||||
msgstr "Nicht registriert"
|
||||
|
||||
msgid "Registered"
|
||||
msgstr "Registriert"
|
||||
|
||||
msgid "Registered (roaming)"
|
||||
msgstr "Registriert (roaming)"
|
||||
|
||||
msgid "Searching.."
|
||||
msgstr "Suche.."
|
||||
|
||||
msgid "Registering denied"
|
||||
msgstr "Registrierung abgelehnt"
|
||||
|
||||
msgid "Waiting to read data from the modem..."
|
||||
msgstr "Daten des Modems werden gelesen..."
|
||||
|
||||
msgid "Waiting for connection data..."
|
||||
msgstr "Auf Datenverbindung warten..."
|
||||
|
||||
msgid "BTS Search"
|
||||
msgstr "BTS-Suche"
|
||||
|
||||
msgid "Search"
|
||||
msgstr "Suche"
|
||||
|
||||
msgid "Search BTS using Cell ID"
|
||||
msgstr "BTS-Suche mit der Cell ID"
|
||||
|
||||
msgid "Hint: To set up a BTS search engine, all you have to do is select the dedicated website for your location."
|
||||
msgstr "Hinweis: Um eine BTS-Suchmaschine einzustellen muss nur eine Webseite für den aktuellen Standort angegeben werden."
|
||||
|
||||
msgid "BTS search settings"
|
||||
msgstr "Einstellungen BTS-Suche"
|
||||
|
||||
msgid "Website to search for BTS"
|
||||
msgstr "Webseite für BTS-Suche"
|
||||
|
||||
msgid "Select a website for searching."
|
||||
msgstr "Webseite für dir Suche auswählen."
|
||||
|
||||
msgid "SIM Slot"
|
||||
msgstr "SIM-Slot"
|
166
luci-app-3ginfo-lite/po/it/3ginfo.po
Normal file
@ -0,0 +1,166 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "Information about 3G/4G/5G connection"
|
||||
msgstr "Informazioni sullo stato della connessione 3G/4G/5G"
|
||||
|
||||
msgid "More information about the 3ginfo on the %seko.one.pl forum%s."
|
||||
msgstr "Maggiori informazioni su 3ginfo su %sforum eko.one.pl%s."
|
||||
|
||||
msgid "eko.one.pl forum"
|
||||
msgstr "forum eko.one.pl"
|
||||
|
||||
msgid "Details"
|
||||
msgstr "Dettagli"
|
||||
|
||||
msgid "USB debug information"
|
||||
msgstr "Debug della porta USB"
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr "Configurazione"
|
||||
|
||||
msgid "General Information"
|
||||
msgstr "Informazione Generale"
|
||||
|
||||
msgid "Modem Information"
|
||||
msgstr "Informazioni sul modem"
|
||||
|
||||
msgid "Cell / Signal Information"
|
||||
msgstr "Informazioni sulla rete / segnale"
|
||||
|
||||
msgid "Technology"
|
||||
msgstr "Tecnologia"
|
||||
|
||||
msgid "Operator"
|
||||
msgstr "Operatore"
|
||||
|
||||
msgid "Signal strength"
|
||||
msgstr "La potenza del segnale"
|
||||
|
||||
msgid "Connection statistics"
|
||||
msgstr "Statistiche di connessione"
|
||||
|
||||
msgid "Modem type"
|
||||
msgstr "Tipo modem"
|
||||
|
||||
msgid "Additional information"
|
||||
msgstr "Informazioni aggiuntive"
|
||||
|
||||
msgid "Revision / Firmware"
|
||||
msgstr "Revisione / Versione firmware"
|
||||
|
||||
msgid "IP adress / Communication Port"
|
||||
msgstr "Indirizzo IP / Porta per la comunicazione"
|
||||
|
||||
msgid "Chip Temperature"
|
||||
msgstr "Temperatura del sistema"
|
||||
|
||||
msgid "Configuration 3ginfo-lite"
|
||||
msgstr "Configurazione 3ginfo-lite"
|
||||
|
||||
msgid "Configuration panel for the 3ginfo-lite application."
|
||||
msgstr "Pannello di configurazione per l'applicazione 3ginfo-lite."
|
||||
|
||||
msgid "Network"
|
||||
msgstr "Rete"
|
||||
|
||||
msgid "IP adress / Port for communication with the modem"
|
||||
msgstr "Indirizzo IP / Porta per la comunicazione con il modem"
|
||||
|
||||
msgid "Protocol"
|
||||
msgstr "Protocollo"
|
||||
|
||||
msgid ""
|
||||
"Select the appropriate settings. <br /> <br />Traditional "
|
||||
"modem. <br /> Select one of the available ttyUSBX "
|
||||
"ports.<br /> <br />HiLink modem. <br /> Enter the IP address "
|
||||
"192.168.X.X under which the modem is available."
|
||||
msgstr ""
|
||||
"Wybierz odpowiednie ustawienia. <br /> <br />Tradycyjny "
|
||||
"modem. <br /> Wybierz jeden z dostępnych portów "
|
||||
"ttyUSBX.<br /> <br />Modem typu HiLink. <br /> Wprowadź adres IP "
|
||||
"192.168.X.X pod którym dostępny jest modem."
|
||||
|
||||
msgid "Very good"
|
||||
msgstr "Bardzo dobry"
|
||||
|
||||
msgid "Good"
|
||||
msgstr "Dobry"
|
||||
|
||||
msgid "Weak"
|
||||
msgstr "Słaby"
|
||||
|
||||
msgid "Very weak"
|
||||
msgstr "Bardzo słaby"
|
||||
|
||||
msgid "Excellent"
|
||||
msgstr "Doskonały"
|
||||
|
||||
msgid "Good"
|
||||
msgstr "Dobry"
|
||||
|
||||
msgid "Mid cell"
|
||||
msgstr "Średni zasięg"
|
||||
|
||||
msgid "Cell edge"
|
||||
msgstr "Na krawędzi zasięgu"
|
||||
|
||||
msgid "SIM status"
|
||||
msgstr "Status karty SIM"
|
||||
|
||||
msgid "Not registered"
|
||||
msgstr "Nie zalogowana do sieci"
|
||||
|
||||
msgid "Registered"
|
||||
msgstr "Zalogowana do sieci"
|
||||
|
||||
msgid "Registered (roaming)"
|
||||
msgstr "Zalogowana do sieci (roaming)"
|
||||
|
||||
msgid "Searching.."
|
||||
msgstr "Wyszukiwanie.."
|
||||
|
||||
msgid "Registering denied"
|
||||
msgstr "Odmowa zalogowana do sieci"
|
||||
|
||||
msgid "Waiting to read data from the modem..."
|
||||
msgstr "Oczekiwanie na odczyt danych z modemu..."
|
||||
|
||||
msgid "Waiting for connection data..."
|
||||
msgstr "Oczekiwanie na dane połączenia..."
|
||||
|
||||
msgid "BTS Search"
|
||||
msgstr "Lokalizacja stacji bazowej"
|
||||
|
||||
msgid "Search"
|
||||
msgstr "Szukaj"
|
||||
|
||||
msgid "Search BTS using Cell ID"
|
||||
msgstr "Wyszukaj BTS po Cell ID"
|
||||
|
||||
msgid "Hint: To set up a BTS search engine, all you have to do is select the dedicated website for your location."
|
||||
msgstr "Wskazówka: Aby skonfigurować wyszukiwarkę BTS, wystarczy wybrać stronę odpowiednią dla swojej lokalizacji."
|
||||
|
||||
msgid "BTS search settings"
|
||||
msgstr "Ustawienia wyszukiwania stacji bazowej"
|
||||
|
||||
msgid "Website to search for BTS"
|
||||
msgstr "Strona do wyszukiwania BTS"
|
||||
|
||||
msgid "Select a website for searching."
|
||||
msgstr "Wybierz stronę internetową służącą do wyszukiwania."
|
||||
|
||||
msgid "SIM Slot"
|
||||
msgstr "Slot SIM"
|
||||
|
||||
msgid "Customizing the appearance of the package"
|
||||
msgstr "Dostosowanie wyglądu pakietu"
|
||||
|
||||
msgid "Hint: The settings below allow you to customize the appearance of the progress bars."
|
||||
msgstr "Podpowiedź: Poniższe ustawienia pozwalają dostosować wygląd pasków postępu."
|
||||
|
||||
msgid "The width of the progress bars"
|
||||
msgstr "Szerokość pasków postępu"
|
||||
|
||||
msgid "Select the width of the progress bars."
|
||||
msgstr "Wybierz szerokość pasków postępu."
|
205
luci-app-3ginfo-lite/po/pl/3ginfo.po
Normal file
@ -0,0 +1,205 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "Information about 3G/4G/5G connection"
|
||||
msgstr "Informacja o statusie połączenia 3G/4G/5G"
|
||||
|
||||
msgid "More information about the 3ginfo on the %seko.one.pl forum%s."
|
||||
msgstr "Więcej informacji o 3ginfo na %sforum eko.one.pl%s."
|
||||
|
||||
msgid "eko.one.pl forum"
|
||||
msgstr "forum eko.one.pl"
|
||||
|
||||
msgid "Details"
|
||||
msgstr "Szczegóły"
|
||||
|
||||
msgid "USB debug information"
|
||||
msgstr "Debugowanie portu USB"
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr "Konfiguracja"
|
||||
|
||||
msgid "General Information"
|
||||
msgstr "Informacje ogólne"
|
||||
|
||||
msgid "Modem Information"
|
||||
msgstr "Informacje o modemie"
|
||||
|
||||
msgid "Cell / Signal Information"
|
||||
msgstr "Informacje o sieci / sygnale"
|
||||
|
||||
msgid "Technology"
|
||||
msgstr "Technologia"
|
||||
|
||||
msgid "Operator"
|
||||
msgstr "Operator"
|
||||
|
||||
msgid "Signal strength"
|
||||
msgstr "Siła sygnału"
|
||||
|
||||
msgid "Connection statistics"
|
||||
msgstr "Statystyki połączenia"
|
||||
|
||||
msgid "Modem type"
|
||||
msgstr "Typ modemu"
|
||||
|
||||
msgid "Additional information"
|
||||
msgstr "Informacje dodatkowe"
|
||||
|
||||
msgid "Revision / Firmware"
|
||||
msgstr "Rewizja / Wersja firmware"
|
||||
|
||||
msgid "IP adress / Communication Port"
|
||||
msgstr "Adres IP / Port do komunikacji"
|
||||
|
||||
msgid "Chip Temperature"
|
||||
msgstr "Temperatura układu"
|
||||
|
||||
msgid "Configuration 3ginfo-lite"
|
||||
msgstr "Konfiguracja 3ginfo-lite"
|
||||
|
||||
msgid "Configuration panel for the 3ginfo-lite application."
|
||||
msgstr "Panel konfiguracyjny dla aplikacji 3ginfo-lite."
|
||||
|
||||
msgid "Network"
|
||||
msgstr "Sieć"
|
||||
|
||||
msgid "IP adress / Port for communication with the modem"
|
||||
msgstr "Adres IP / Port do komunikacji z modemem"
|
||||
|
||||
msgid "Protocol"
|
||||
msgstr "Protokół"
|
||||
|
||||
msgid ""
|
||||
"Select the appropriate settings. <br /> <br />Traditional "
|
||||
"modem. <br /> Select one of the available ttyUSBX "
|
||||
"ports.<br /> <br />HiLink modem. <br /> Enter the IP address "
|
||||
"192.168.X.X under which the modem is available."
|
||||
msgstr ""
|
||||
"Wybierz odpowiednie ustawienia. <br /> <br />Tradycyjny "
|
||||
"modem. <br /> Wybierz jeden z dostępnych portów "
|
||||
"ttyUSBX.<br /> <br />Modem typu HiLink. <br /> Wprowadź adres IP "
|
||||
"192.168.X.X pod którym dostępny jest modem."
|
||||
|
||||
msgid "Very good"
|
||||
msgstr "Bardzo dobry"
|
||||
|
||||
msgid "Good"
|
||||
msgstr "Dobry"
|
||||
|
||||
msgid "Weak"
|
||||
msgstr "Słaby"
|
||||
|
||||
msgid "Very weak"
|
||||
msgstr "Bardzo słaby"
|
||||
|
||||
msgid "Excellent"
|
||||
msgstr "Doskonały"
|
||||
|
||||
msgid "Good"
|
||||
msgstr "Dobry"
|
||||
|
||||
msgid "Mid cell"
|
||||
msgstr "Średni zasięg"
|
||||
|
||||
msgid "Cell edge"
|
||||
msgstr "Na krawędzi zasięgu"
|
||||
|
||||
msgid "SIM status"
|
||||
msgstr "Status karty SIM"
|
||||
|
||||
msgid "Not registered"
|
||||
msgstr "Nie zalogowana do sieci"
|
||||
|
||||
msgid "Registered"
|
||||
msgstr "Zalogowana do sieci"
|
||||
|
||||
msgid "Registered (roaming)"
|
||||
msgstr "Zalogowana do sieci (roaming)"
|
||||
|
||||
msgid "Searching.."
|
||||
msgstr "Wyszukiwanie.."
|
||||
|
||||
msgid "Registering denied"
|
||||
msgstr "Odmowa zalogowana do sieci"
|
||||
|
||||
msgid "Waiting to read data from the modem..."
|
||||
msgstr "Oczekiwanie na odczyt danych z modemu..."
|
||||
|
||||
msgid "Waiting for connection data..."
|
||||
msgstr "Oczekiwanie na dane połączenia..."
|
||||
|
||||
msgid "BTS Search"
|
||||
msgstr "Lokalizacja stacji bazowej"
|
||||
|
||||
msgid "Search"
|
||||
msgstr "Szukaj"
|
||||
|
||||
msgid "Search BTS using Cell ID"
|
||||
msgstr "Wyszukaj BTS po Cell ID"
|
||||
|
||||
msgid "Hint: To set up a BTS search engine, all you have to do is select the dedicated website for your location."
|
||||
msgstr "Wskazówka: Aby skonfigurować wyszukiwarkę BTS, wystarczy wybrać stronę odpowiednią dla swojej lokalizacji."
|
||||
|
||||
msgid "BTS search settings"
|
||||
msgstr "Ustawienia wyszukiwania stacji bazowej"
|
||||
|
||||
msgid "Website to search for BTS"
|
||||
msgstr "Strona do wyszukiwania BTS"
|
||||
|
||||
msgid "Select a website for searching."
|
||||
msgstr "Wybierz stronę internetową służącą do wyszukiwania."
|
||||
|
||||
msgid "SIM Slot"
|
||||
msgstr "Slot SIM"
|
||||
|
||||
msgid "Problem with registering to the network, check the SIM card."
|
||||
msgstr "Problem z rejestracją do sieci, sprawdź kartę SIM."
|
||||
|
||||
msgid "SIM PIN required"
|
||||
msgstr "Wymagany jest kod PIN dla karty SIM"
|
||||
|
||||
msgid "SIM PUK required"
|
||||
msgstr "Wymagany jest kod PUK dla karty SIM"
|
||||
|
||||
msgid "SIM failure"
|
||||
msgstr "Awaria karty SIM"
|
||||
|
||||
msgid "SIM busy"
|
||||
msgstr "Karta SIM jest zajęta"
|
||||
|
||||
msgid "SIM wrong"
|
||||
msgstr "Nieprawidłowa karta SIM"
|
||||
|
||||
msgid "SIM PIN2 required"
|
||||
msgstr "Wymagany jest kod PIN2 dla karty SIM"
|
||||
|
||||
msgid "SIM PUK2 required"
|
||||
msgstr "Wymagany jest kod PUK2 dla karty SIM"
|
||||
|
||||
msgid ""
|
||||
"There is a problem reading data from the modem. <br /><br /><b>Please "
|
||||
"check:</b> <ul><li>1. Modem availability in the system.</li><li>2. The correct "
|
||||
"installation of the SIM card in the modem.</li><li> 3. Port for communication with the modem.</li><li><ul>"
|
||||
msgstr ""
|
||||
"Wystąpił problem z odczytem danych z modemu. <br /><br /><b>Proszę "
|
||||
"sprawdzić:</b> <ul><li>1. Dostępność modemu w systemie.</li><li>2. Poprawność "
|
||||
"montażu karty SIM w modemie.</li><li> 3. Port do komunikacji z modemem.</li><li><ul>"
|
||||
|
||||
msgid ""
|
||||
"There is a problem reading connection data. <br /><br /><b>Please "
|
||||
"check:</b> <ul><li>1. Connection of the modem to the internet, the correctness of the entered APN. Some modems need to force the APN on the modem using at commands "
|
||||
"to connect to internet.</li><li> 2. Check that the correct interface assigned to the modem is selected. The default name of the interface in the package is wan.</li><li><ul>"
|
||||
msgstr ""
|
||||
"Wystąpił problem z odczytem danych połączenia. <br /><br /><b>Proszę "
|
||||
"sprawdzić:</b> <ul><li>1. Połączenie modemu z internetem, poprawność wprowadzonego APN. Niektóre modemy wymagają wymuszenia APN w modemie za pomocą komend at, aby "
|
||||
"połączyć się z internetem.</li><li> 2. Sprawdź, czy wybrany został właściwy interfejs przypisany do modemu. Domyślną nazwą interfejsu w pakiecie jest wan.</li><li><ul>"
|
||||
|
||||
msgid "Defined modems"
|
||||
msgstr "Zdefiniowane modemy"
|
||||
|
||||
msgid "Interface for selecting user defined modems."
|
||||
msgstr "Interfejs wyboru modemów zdefiniowanych przez użytkownika."
|
||||
|
||||
msgid "Modem selection menu"
|
||||
msgstr "Menu wyboru modemu"
|
78
luci-app-3ginfo-lite/po/template/3ginfo.po
Normal file
@ -0,0 +1,78 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/controller/modem/3ginfo.lua:9
|
||||
msgid "Information about 3G/4G connection"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/controller/modem/3ginfo.lua:10
|
||||
msgid "Details"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/controller/modem/3ginfo.lua:11
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:106
|
||||
msgid "Information about 3G/4G connection"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:110
|
||||
msgid "Status:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:111
|
||||
msgid "Connection time:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:112
|
||||
msgid "Downloaded:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:113
|
||||
msgid "Uploaded:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:114
|
||||
msgid "Mode:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:115
|
||||
msgid "Operator:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:117
|
||||
msgid "Signal strength:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:119
|
||||
msgid "Modem type:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/view/modem/3gdetail.lua:124
|
||||
msgid "Additional information"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/model/cbi/modem/3gconfig.lua:11
|
||||
msgid "Configuration 3ginfo"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/model/cbi/modem/3gconfig.lua:12
|
||||
msgid "Configuration panel for the 3ginfo application."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/model/cbi/modem/3gconfig.lua:17
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/model/cbi/modem/3gconfig.lua:20
|
||||
msgid "Device"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/model/cbi/modem/3gconfig.lua:28
|
||||
msgid "SIM PIN (optional)"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-3ginfo/luasrc/model/cbi/modem/3gconfig.lua:31
|
||||
msgid "Language"
|
||||
msgstr ""
|
7
luci-app-3ginfo-lite/root/etc/config/3ginfo
Normal file
@ -0,0 +1,7 @@
|
||||
config 3ginfo 'modem1'
|
||||
option network 'usbwan'
|
||||
option device '/dev/ttyUSB2'
|
||||
|
||||
config 3ginfo 'modem2'
|
||||
option network 'usbwan'
|
||||
option device '/dev/ttyUSB2'
|
41
luci-app-3ginfo-lite/root/etc/uci-defaults/set_3ginfo_port.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2020-2023 Rafał Wabik (IceG) - From eko.one.pl forum
|
||||
# MIT License
|
||||
|
||||
chmod +x /usr/share/3ginfo-lite/3ginfo.sh 2>&1 &
|
||||
chmod +x /usr/share/3ginfo-lite/detect.sh 2>&1 &
|
||||
chmod +x /usr/share/3ginfo-lite/hilink/alcatel_hilink.sh 2>&1 &
|
||||
chmod +x /usr/share/3ginfo-lite/hilink/huawei_hilink.sh 2>&1 &
|
||||
chmod +x /usr/share/3ginfo-lite/hilink/zte.sh 2>&1 &
|
||||
rm -rf /tmp/luci-indexcache 2>&1 &
|
||||
rm -rf /tmp/luci-modulecache/ 2>&1 &
|
||||
|
||||
DEVICE=$(cat /tmp/sysinfo/board_name)
|
||||
|
||||
if [[ "$DEVICE" == *"mf289f"* ]]; then
|
||||
|
||||
uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" 2>&1 &
|
||||
uci commit 3ginfo 2>&1 &
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$DEVICE" == *"mf286r"* ]]; then
|
||||
|
||||
uci set 3ginfo.@3ginfo[0].device="/dev/ttyACM0" 2>&1 &
|
||||
uci commit 3ginfo 2>&1 &
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$DEVICE" == *"mf286d"* ]]; then
|
||||
|
||||
uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" 2>&1 &
|
||||
uci commit 3ginfo 2>&1 &
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$DEVICE" == *"mf286"* ]]; then
|
||||
|
||||
uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" 2>&1 &
|
||||
uci commit 3ginfo 2>&1 &
|
||||
|
||||
fi
|
422
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo.sh
Executable file
@ -0,0 +1,422 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# (c) 2010-2023 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
#
|
||||
# (c) 2021-2023 modified by Rafał Wabik - IceG - From eko.one.pl forum
|
||||
#
|
||||
|
||||
|
||||
band() {
|
||||
# see https://en.wikipedia.org/wiki/LTE_frequency_bands
|
||||
echo -n "B${1}"
|
||||
case "${1}" in
|
||||
"1") echo " (2100 MHz)";;
|
||||
"2") echo " (1900 MHz)";;
|
||||
"3") echo " (1800 MHz)";;
|
||||
"4") echo " (1700 MHz)";;
|
||||
"5") echo " (850 MHz)";;
|
||||
"7") echo " (2600 MHz)";;
|
||||
"8") echo " (900 MHz)";;
|
||||
"11") echo " (1500 MHz)";;
|
||||
"12") echo " (700 MHz)";;
|
||||
"13") echo " (700 MHz)";;
|
||||
"14") echo " (700 MHz)";;
|
||||
"17") echo " (700 MHz)";;
|
||||
"18") echo " (850 MHz)";;
|
||||
"19") echo " (850 MHz)";;
|
||||
"20") echo " (800 MHz)";;
|
||||
"21") echo " (1500 MHz)";;
|
||||
"24") echo " (1600 MHz)";;
|
||||
"25") echo " (1900 MHz)";;
|
||||
"26") echo " (850 MHz)";;
|
||||
"28") echo " (700 MHz)";;
|
||||
"29") echo " (700 MHz)";;
|
||||
"30") echo " (2300 MHz)";;
|
||||
"31") echo " (450 MHz)";;
|
||||
"32") echo " (1500 MHz)";;
|
||||
"34") echo " (2000 MHz)";;
|
||||
"37") echo " (1900 MHz)";;
|
||||
"38") echo " (2600 MHz)";;
|
||||
"39") echo " (1900 MHz)";;
|
||||
"40") echo " (2300 MHz)";;
|
||||
"41") echo " (2500 MHz)";;
|
||||
"42") echo " (3500 MHz)";;
|
||||
"43") echo " (3700 MHz)";;
|
||||
"46") echo " (5200 MHz)";;
|
||||
"47") echo " (5900 MHz)";;
|
||||
"48") echo " (3500 MHz)";;
|
||||
"50") echo " (1500 MHz)";;
|
||||
"51") echo " (1500 MHz)";;
|
||||
"53") echo " (2400 MHz)";;
|
||||
"54") echo " (1600 MHz)";;
|
||||
"65") echo " (2100 MHz)";;
|
||||
"66") echo " (1700 MHz)";;
|
||||
"67") echo " (700 MHz)";;
|
||||
"69") echo " (2600 MHz)";;
|
||||
"70") echo " (1700 MHz)";;
|
||||
"71") echo " (600 MHz)";;
|
||||
"72") echo " (450 MHz)";;
|
||||
"73") echo " (450 MHz)";;
|
||||
"74") echo " (1500 MHz)";;
|
||||
"75") echo " (1500 MHz)";;
|
||||
"76") echo " (1500 MHz)";;
|
||||
"85") echo " (700 MHz)";;
|
||||
"87") echo " (410 MHz)";;
|
||||
"88") echo " (410 MHz)";;
|
||||
"103") echo " (700 MHz)";;
|
||||
"106") echo " (900 MHz)";;
|
||||
"*") echo "";;
|
||||
esac
|
||||
}
|
||||
|
||||
band5g() {
|
||||
# see https://en.wikipedia.org/wiki/5G_NR_frequency_bands
|
||||
echo -n "n${1}"
|
||||
case "${1}" in
|
||||
"1") echo " (2100 MHz)";;
|
||||
"2") echo " (1900 MHz)";;
|
||||
"3") echo " (1800 MHz)";;
|
||||
"5") echo " (850 MHz)";;
|
||||
"7") echo " (2600 MHz)";;
|
||||
"8") echo " (900 MHz)";;
|
||||
"12") echo " (700 MHz)";;
|
||||
"13") echo " (700 MHz)";;
|
||||
"14") echo " (700 MHz)";;
|
||||
"18") echo " (850 MHz)";;
|
||||
"20") echo " (800 MHz)";;
|
||||
"24") echo " (1600 MHz)";;
|
||||
"25") echo " (1900 MHz)";;
|
||||
"26") echo " (850 MHz)";;
|
||||
"28") echo " (700 MHz)";;
|
||||
"29") echo " (700 MHz)";;
|
||||
"30") echo " (2300 MHz)";;
|
||||
"34") echo " (2100 MHz)";;
|
||||
"38") echo " (2600 MHz)";;
|
||||
"39") echo " (1900 MHz)";;
|
||||
"40") echo " (2300 MHz)";;
|
||||
"41") echo " (2500 MHz)";;
|
||||
"46") echo " (5200 MHz)";;
|
||||
"47") echo " (5900 MHz)";;
|
||||
"48") echo " (3500 MHz)";;
|
||||
"50") echo " (1500 MHz)";;
|
||||
"51") echo " (1500 MHz)";;
|
||||
"53") echo " (2400 MHz)";;
|
||||
"54") echo " (1600 MHz)";;
|
||||
"65") echo " (2100 MHz)";;
|
||||
"66") echo " (1700/2100 MHz)";;
|
||||
"67") echo " (700 MHz)";;
|
||||
"70") echo " (2000 MHz)";;
|
||||
"71") echo " (600 MHz)";;
|
||||
"74") echo " (1500 MHz)";;
|
||||
"75") echo " (1500 MHz)";;
|
||||
"76") echo " (1500 MHz)";;
|
||||
"77") echo " (3700 MHz)";;
|
||||
"78") echo " (3500 MHz)";;
|
||||
"79") echo " (4700 MHz)";;
|
||||
"80") echo " (1800 MHz)";;
|
||||
"81") echo " (900 MHz)";;
|
||||
"82") echo " (800 MHz)";;
|
||||
"83") echo " (700 MHz)";;
|
||||
"84") echo " (2100 MHz)";;
|
||||
"85") echo " (700 MHz)";;
|
||||
"86") echo " (1700 MHz)";;
|
||||
"89") echo " (850 MHz)";;
|
||||
"90") echo " (2500 MHz)";;
|
||||
"91") echo " (800/1500 MHz)";;
|
||||
"92") echo " (800/1500 MHz)";;
|
||||
"93") echo " (900/1500 MHz)";;
|
||||
"94") echo " (900/1500 MHz)";;
|
||||
"95") echo " (2100 MHz)";;
|
||||
"96") echo " (6000 MHz)";;
|
||||
"97") echo " (2300 MHz)";;
|
||||
"98") echo " (1900 MHz)";;
|
||||
"99") echo " (1600 MHz)";;
|
||||
"100") echo " (900 MHz)";;
|
||||
"101") echo " (1900 MHz)";;
|
||||
"102") echo " (6200 MHz)";;
|
||||
"104") echo " (6700 MHz)";;
|
||||
"105") echo " (600 MHz)";;
|
||||
"257") echo " (28 GHz)";;
|
||||
"258") echo " (26 GHz)";;
|
||||
"259") echo " (41 GHz)";;
|
||||
"260") echo " (39 GHz)";;
|
||||
"261") echo " (28 GHz)";;
|
||||
"262") echo " (47 GHz)";;
|
||||
"263") echo " (60 GHz)";;
|
||||
"*") echo "";;
|
||||
esac
|
||||
}
|
||||
|
||||
getdevicevendorproduct() {
|
||||
devname="$(basename $1)"
|
||||
case "$devname" in
|
||||
'ttyACM'*)
|
||||
devpath="$(readlink -f /sys/class/tty/$devname/device)"
|
||||
T=${devpath%/*}
|
||||
echo "$(cat $T/idVendor)$(cat $T/idProduct)"
|
||||
;;
|
||||
'tty'*)
|
||||
devpath="$(readlink -f /sys/class/tty/$devname/device)"
|
||||
T=${devpath%/*/*}
|
||||
echo "$(cat $T/idVendor)$(cat $T/idProduct)"
|
||||
;;
|
||||
*)
|
||||
devpath="$(readlink -f /sys/class/usbmisc/$devname/device)"
|
||||
T=${devpath%/*}
|
||||
echo "$(cat $T/idVendor)$(cat $T/idProduct)"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
RES="/usr/share/3ginfo-lite"
|
||||
|
||||
idx=$1
|
||||
test -n "$idx" || idx=0
|
||||
|
||||
DEVICE=$($RES/detect.sh $idx)
|
||||
if [ -z "$DEVICE" ]; then
|
||||
echo '{"error":"Device not found"}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
O=""
|
||||
if [ -e /usr/bin/sms_tool ]; then
|
||||
O=$(sms_tool -D -d $DEVICE at "AT+CPIN?;+CSQ;+COPS=3,0;+COPS?;+COPS=3,2;+COPS?;+CREG=2;+CREG?")
|
||||
else
|
||||
O=$(gcom -d $DEVICE -s $RES/info.gcom 2>/dev/null)
|
||||
fi
|
||||
|
||||
|
||||
SECT=$(uci -q get 3ginfo.@3ginfo[$idx].network)
|
||||
|
||||
SUB='@'
|
||||
if [[ "$SECT" == *"$SUB"* ]]; then
|
||||
SEC=$(echo $SECT | sed 's/@//')
|
||||
else
|
||||
SEC=$(uci -q get 3ginfo.@3ginfo[$idx].network)
|
||||
fi
|
||||
if [ -z "$SEC" ]; then
|
||||
P=$DEVICE
|
||||
PORIG=$P
|
||||
for DEV in /sys/class/tty/* /sys/class/usbmisc/*; do
|
||||
P="/dev/"${DEV##/*/}
|
||||
if [ "x$PORIG" = "x$P" ]; then
|
||||
SEC=$(uci show network | grep "/dev/"${DEV##/*/} | cut -f2 -d.)
|
||||
[ -n "$SEC" ] && break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
CONN_TIME="-"
|
||||
RX="-"
|
||||
TX="-"
|
||||
|
||||
NETUP=$(ifstatus $SEC | grep "\"up\": true")
|
||||
if [ -n "$NETUP" ]; then
|
||||
|
||||
CT=$(uci -q -P /var/state/ get network.$SEC.connect_time)
|
||||
if [ -z $CT ]; then
|
||||
CT=$(ifstatus $SEC | awk -F[:,] '/uptime/ {print $2}' | xargs)
|
||||
else
|
||||
UPTIME=$(cut -d. -f1 /proc/uptime)
|
||||
CT=$((UPTIME-CT))
|
||||
fi
|
||||
if [ ! -z $CT ]; then
|
||||
D=$(expr $CT / 60 / 60 / 24)
|
||||
H=$(expr $CT / 60 / 60 % 24)
|
||||
M=$(expr $CT / 60 % 60)
|
||||
S=$(expr $CT % 60)
|
||||
CONN_TIME=$(printf "%dd, %02d:%02d:%02d" $D $H $M $S)
|
||||
fi
|
||||
IFACE=$(ifstatus $SEC | awk -F\" '/l3_device/ {print $4}')
|
||||
if [ -n "$IFACE" ]; then
|
||||
RX=$(ifconfig $IFACE | awk -F[\(\)] '/bytes/ {printf "%s",$2}')
|
||||
TX=$(ifconfig $IFACE | awk -F[\(\)] '/bytes/ {printf "%s",$4}')
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# CSQ
|
||||
CSQ=$(echo "$O" | awk -F[,\ ] '/^\+CSQ/ {print $2}')
|
||||
|
||||
[ "x$CSQ" = "x" ] && CSQ=-1
|
||||
if [ $CSQ -ge 0 -a $CSQ -le 31 ]; then
|
||||
CSQ_PER=$(($CSQ * 100/31))
|
||||
else
|
||||
CSQ=""
|
||||
CSQ_PER=""
|
||||
fi
|
||||
|
||||
# COPS numeric
|
||||
COPS=""
|
||||
COPS_MCC=""
|
||||
COPS_MNC=""
|
||||
COPS_NUM=$(echo "$O" | awk -F[\"] '/^\+COPS: .,2/ {print $2}')
|
||||
if [ -n "$COPS_NUM" ]; then
|
||||
COPS_MCC=${COPS_NUM:0:3}
|
||||
COPS_MNC=${COPS_NUM:3:3}
|
||||
fi
|
||||
|
||||
if [ -z "$FORCE_PLMN" ]; then
|
||||
COPS=$(echo "$O" | awk -F[\"] '/^\+COPS: .,0/ {print $2}')
|
||||
else
|
||||
[ -n "$COPS_NUM" ] && COPS=$(awk -F[\;] '/^'$COPS_NUM';/ {print $2}' $RES/mccmnc.dat)
|
||||
fi
|
||||
[ -z "$COPS" ] && COPS=$COPS_NUM
|
||||
|
||||
COPZ=$(echo $COPS | sed ':s;s/\(\<\S*\>\)\(.*\)\<\1\>/\1\2/g;ts')
|
||||
COPS=$(echo $COPZ | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1')
|
||||
|
||||
T=$(echo "$O" | awk -F[,\ ] '/^\+CPIN:/ {print $0;exit}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ "$T" = "+CPIN: READY" ] || REG=$(echo "$T" | cut -f2 -d: | xargs)
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,\ ] '/^\+CME ERROR:/ {print $0;exit}')
|
||||
if [ -n "$T" ]; then
|
||||
case "$T" in
|
||||
"+CME ERROR: 10"*) REG="SIM not inserted";;
|
||||
"+CME ERROR: 11"*) REG="SIM PIN required";;
|
||||
"+CME ERROR: 12"*) REG="SIM PUK required";;
|
||||
"+CME ERROR: 13"*) REG="SIM failure";;
|
||||
"+CME ERROR: 14"*) REG="SIM busy";;
|
||||
"+CME ERROR: 15"*) REG="SIM wrong";;
|
||||
"+CME ERROR: 17"*) REG="SIM PIN2 required";;
|
||||
"+CME ERROR: 18"*) REG="SIM PUK2 required";;
|
||||
*) REG=$(echo "$T" | cut -f2 -d: | xargs);;
|
||||
esac
|
||||
fi
|
||||
|
||||
# CREG
|
||||
eval $(echo "$O" | awk -F[,] '/^\+CREG/ {gsub(/[[:space:]"]+/,"");printf "T=\"%d\";LAC_HEX=\"%X\";CID_HEX=\"%X\";LAC_DEC=\"%d\";CID_DEC=\"%d\";MODE_NUM=\"%d\"", $2, "0x"$3, "0x"$4, "0x"$3, "0x"$4, $5}')
|
||||
case "$T" in
|
||||
0*)
|
||||
REG="0";;
|
||||
1*)
|
||||
REG="1";;
|
||||
2*)
|
||||
REG="2";;
|
||||
3*)
|
||||
REG="3";;
|
||||
5*)
|
||||
REG="5";;
|
||||
6*)
|
||||
REG="6";;
|
||||
7*)
|
||||
REG="7";;
|
||||
*)
|
||||
REG="";;
|
||||
esac
|
||||
|
||||
# MODE
|
||||
MODE_NUM=$(echo "$MODE_NUM" | tr -d '\r\n')
|
||||
if [ -z "$MODE_NUM" ] || [ "x$MODE_NUM" = "x0" ]; then
|
||||
MODE_NUM=$(echo "$O" | awk -F[,] '/^\+COPS/ {print $4;exit}')
|
||||
MODE_NUM=$(echo "$MODE_NUM" | tr -d '\r\n')
|
||||
fi
|
||||
case "$MODE_NUM" in
|
||||
2*) MODE="UMTS";;
|
||||
3*) MODE="EDGE";;
|
||||
4*) MODE="HSDPA";;
|
||||
5*) MODE="HSUPA";;
|
||||
6*) MODE="HSPA";;
|
||||
7*) MODE="LTE";;
|
||||
*) MODE="-";;
|
||||
esac
|
||||
|
||||
# TAC
|
||||
OTX=$(sms_tool -d $DEVICE at "at+cereg")
|
||||
TAC=$(echo "$OTX" | awk -F[,] '/^\+CEREG/ {printf "%s", toupper($3)}' | sed 's/[^A-F0-9]//g')
|
||||
if [ "x$TAC" != "x" ]; then
|
||||
TAC_HEX=$(printf %d 0x$TAC)
|
||||
else
|
||||
TAC="-"
|
||||
TAC_HEX="-"
|
||||
fi
|
||||
|
||||
CONF_DEVICE=$(uci -q get 3ginfo.@3ginfo[$idx].device)
|
||||
if echo "x$CONF_DEVICE" | grep -q "192.168."; then
|
||||
if grep -q "Vendor=1bbb" /sys/kernel/debug/usb/devices; then
|
||||
. $RES/hilink/alcatel_hilink.sh $DEVICE
|
||||
fi
|
||||
if grep -q "Vendor=12d1" /sys/kernel/debug/usb/devices; then
|
||||
. $RES/hilink/huawei_hilink.sh $DEVICE
|
||||
fi
|
||||
if grep -q "Vendor=19d2" /sys/kernel/debug/usb/devices; then
|
||||
. $RES/hilink/zte.sh $DEVICE
|
||||
fi
|
||||
SEC=$(uci -q get 3ginfo.@3ginfo[$idx].network)
|
||||
SEC=${SEC:-wan}
|
||||
else
|
||||
|
||||
if [ -e /usr/bin/sms_tool ]; then
|
||||
REGOK=0
|
||||
[ "x$REG" = "x1" ] || [ "x$REG" = "x5" ] && REGOK=1
|
||||
VIDPID=$(getdevicevendorproduct $DEVICE)
|
||||
if [ -e "$RES/modem/$VIDPID" ]; then
|
||||
case $(cat /tmp/sysinfo/board_name) in
|
||||
"zte,mf289f")
|
||||
. "$RES/modem/19d21485"
|
||||
;;
|
||||
*)
|
||||
. "$RES/modem/$VIDPID"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
cat <<EOF
|
||||
{
|
||||
"connt":"$CONN_TIME",
|
||||
"conntx":"$TX",
|
||||
"connrx":"$RX",
|
||||
"modem":"$MODEL",
|
||||
"mtemp":"$TEMP",
|
||||
"firmware":"$FW",
|
||||
"cport":"$DEVICE",
|
||||
"protocol":"$PROTO",
|
||||
"csq":"$CSQ",
|
||||
"signal":"$CSQ_PER",
|
||||
"operator_name":"$COPS",
|
||||
"operator_mcc":"$COPS_MCC",
|
||||
"operator_mnc":"$COPS_MNC",
|
||||
"mode":"$MODE",
|
||||
"registration":"$REG",
|
||||
"simslot":"$SSIM",
|
||||
"imei":"$NR_IMEI",
|
||||
"imsi":"$NR_IMSI",
|
||||
"iccid":"$NR_ICCID",
|
||||
"lac_dec":"$LAC_DEC",
|
||||
"lac_hex":"$LAC_HEX",
|
||||
"tac_dec":"$TAC_DEC",
|
||||
"tac_hex":"$TAC_HEX",
|
||||
"tac_h":"$T_HEX",
|
||||
"tac_d":"$T_DEC",
|
||||
"cid_dec":"$CID_DEC",
|
||||
"cid_hex":"$CID_HEX",
|
||||
"pci":"$(echo -n $PCI | tr -d '\r')",
|
||||
"earfcn":"$EARFCN",
|
||||
"pband":"$PBAND",
|
||||
"s1band":"$S1BAND",
|
||||
"s1pci":"$S1PCI",
|
||||
"s1earfcn":"$S1EARFCN",
|
||||
"s2band":"$S2BAND",
|
||||
"s2pci":"$S2PCI",
|
||||
"s2earfcn":"$S2EARFCN",
|
||||
"s3band":"$S3BAND",
|
||||
"s3pci":"$S3PCI",
|
||||
"s3earfcn":"$S3EARFCN",
|
||||
"s4band":"$S4BAND",
|
||||
"s4pci":"$S4PCI",
|
||||
"s4earfcn":"$S4EARFCN",
|
||||
"rsrp":"$RSRP",
|
||||
"rsrq":"$RSRQ",
|
||||
"rssi":"$RSSI",
|
||||
"sinr":"$SINR"
|
||||
}
|
||||
EOF
|
||||
exit 0
|
13
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/check.gcom
Normal file
@ -0,0 +1,13 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.01
|
||||
waitquiet 0.01 0.01
|
||||
|
||||
send "AT+CPIN?^m"
|
||||
waitfor 2 "OK" "+CME ERROR"
|
||||
if % = -1 goto timeout
|
||||
exit 0
|
||||
|
||||
:timeout
|
||||
exit 1
|
24
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/detect.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# (c) 2023 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
#
|
||||
# (c) 2023 modified by Rafał Wabik - IceG - From eko.one.pl forum
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# from config modemdefine
|
||||
#
|
||||
|
||||
idx=$1
|
||||
test -n "$idx" || idx=0
|
||||
|
||||
# from config
|
||||
DEVICE=$(uci -q get 3ginfo.@3ginfo[$idx].device)
|
||||
if [ -n "$DEVICE" ]; then
|
||||
echo $DEVICE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 0
|
63
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/hilink/alcatel_hilink.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# (c) 2010-2021 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
#
|
||||
# (c) 2021 modified by Rafał Wabik - IceG - From eko.one.pl forum
|
||||
#
|
||||
|
||||
IP=$1
|
||||
[ -z "$IP" ] && exit 0
|
||||
[ -e /usr/bin/wget ] || exit 0
|
||||
|
||||
getvaluen() {
|
||||
echo $(sed 's!.*"'$2'":\([^,]*\).*!\1!g' /tmp/$1)
|
||||
}
|
||||
|
||||
getvalue() {
|
||||
echo $(sed 's!.*"'$2'":"\([^"]*\).*!\1!g' /tmp/$1)
|
||||
}
|
||||
|
||||
rand=`awk 'BEGIN{srand();print int(rand()*(99000-1000))+1000 }'`
|
||||
|
||||
files="getWanInfo getImgInfo getSysteminfo"
|
||||
for f in $files; do
|
||||
wget -t 3 -O /tmp/$f "http://$IP/goform/$f?rand=$rand" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
MODEN=$(getvaluen getWanInfo "network_type")
|
||||
case $MODEN in
|
||||
1) MODE="GPRS";;
|
||||
2) MODE="EDGE";;
|
||||
3) MODE="HSDPA";;
|
||||
4) MODE="HSUPA";;
|
||||
5) MODE="UMTS";;
|
||||
9) MODE="GSM";;
|
||||
11) MODE="LTE";;
|
||||
12) MODE="HSPA+";;
|
||||
13) MODE="DC HSPA+";;
|
||||
*) MODE="-";;
|
||||
esac
|
||||
echo "^SYSINFOEX:x,x,x,x,,x,\"$MODE\",$MODEN,\"$MODE\""
|
||||
|
||||
COPS=$(getvalue getWanInfo "network_name")
|
||||
echo "+COPS: 0,0,\"$OPER\",x"
|
||||
|
||||
SIGNAL=$(getvaluen getImgInfo "signal")
|
||||
case $SIGNAL in
|
||||
1) CSQ="6";;
|
||||
2) CSQ="12";;
|
||||
3) CSQ="18";;
|
||||
4) CSQ="24";;
|
||||
5) CSQ="31";;
|
||||
*) CSQ="0";;
|
||||
esac
|
||||
echo "+CSQ: $CSQ,99"
|
||||
|
||||
MODEL=$(getvalue getSysteminfo "dev_name")
|
||||
echo MODEL="Alcatel $MODEL"
|
||||
|
||||
if [ "x$2" != "xdebug" ]; then
|
||||
for f in $files; do
|
||||
rm /tmp/$f
|
||||
done
|
||||
fi
|
181
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/hilink/huawei_hilink.sh
Executable file
@ -0,0 +1,181 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# (c) 2010-2021 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
#
|
||||
# (c) 2021 modified by Rafał Wabik - IceG - From eko.one.pl forum
|
||||
#
|
||||
|
||||
IP=$1
|
||||
[ -z "$IP" ] && exit 0
|
||||
[ -e /usr/bin/wget ] || exit 0
|
||||
getvaluen() {
|
||||
echo $(awk -F[\<\>] '/<'$2'>/ {print $3}' /tmp/$1 | sed 's/[^0-9]//g')
|
||||
}
|
||||
|
||||
getvaluens() {
|
||||
echo $(awk -F[\<\>] '/<'$2'>/ {print $3}' /tmp/$1 | sed 's/[^0-9-]//g')
|
||||
}
|
||||
|
||||
getvalue() {
|
||||
echo $(awk -F[\<\>] '/<'$2'>/ {print $3}' /tmp/$1)
|
||||
}
|
||||
|
||||
cookie=$(mktemp)
|
||||
/usr/bin/wget -t 25 -O /tmp/webserver-token "http://$IP/api/webserver/token" >/dev/null 2>&1
|
||||
token=$(getvaluen webserver-token token)
|
||||
if [ -z "$token" ]; then
|
||||
/usr/bin/wget -t 25 -O /tmp/webserver-token "http://$IP/api/webserver/SesTokInfo" >/dev/null 2>&1
|
||||
sesinfo=$(getvalue webserver-token SesInfo)
|
||||
fi
|
||||
if [ -z "$sesinfo" ]; then
|
||||
/usr/bin/wget -q -O /dev/null --keep-session-cookies --save-cookies $cookie "http://$IP/html/home.html"
|
||||
fi
|
||||
|
||||
files="device/signal monitoring/status net/current-plmn net/signal-para device/information device/basic_information"
|
||||
for f in $files; do
|
||||
nf=$(echo $f | sed 's!/!-!g')
|
||||
if [ -n "$token" ]; then
|
||||
/usr/bin/wget -t 3 -O /tmp/$nf "http://$IP/api/$f" --header "__RequestVerificationToken: $token" >/dev/null 2>&1
|
||||
elif [ -n "$sesinfo" ]; then
|
||||
/usr/bin/wget -t 3 -O /tmp/$nf "http://$IP/api/$f" --header "Cookie: $sesinfo" >/dev/null 2>&1
|
||||
else
|
||||
/usr/bin/wget -t 3 -O /tmp/$nf "http://$IP/api/$f" --load-cookies=$cookie >/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
|
||||
# Protocol
|
||||
# Driver=qmi_wwan & Driver=cdc_mbim & Driver=cdc_ether & Driver=huawei_cdc_ncm
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=12d1 ProdID=' '{print $2}' | cut -c-1108)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="QMI"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="MBIM"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ECM"
|
||||
elif echo "$PVCUT" | grep -q "Driver=huawei_cdc_ncm"
|
||||
then
|
||||
PROTO="NCM"
|
||||
fi
|
||||
|
||||
RSSI=$(getvaluen device-signal rssi)
|
||||
if [ -n "$RSSI" ]; then
|
||||
CSQ=$(((-1*RSSI + 113)/2))
|
||||
CSQ_PER=$(($CSQ * 100/31))
|
||||
else
|
||||
CSQ_PER=$(getvaluen monitoring-status SignalStrength)
|
||||
if [ -n "$CSQ_PER" ]; then
|
||||
CSQ=$((($CSQ_PER*31)/100))
|
||||
fi
|
||||
fi
|
||||
|
||||
MODEN=$(getvaluen monitoring-status CurrentNetworkType)
|
||||
case $MODEN in
|
||||
1) MODE="GSM";;
|
||||
2) MODE="GPRS";;
|
||||
3) MODE="EDGE";;
|
||||
4) MODE="WCDMA";;
|
||||
5) MODE="HSDPA";;
|
||||
6) MODE="HSUPA";;
|
||||
7) MODE="HSPA";;
|
||||
8) MODE="TDSCDMA";;
|
||||
9) MODE="HSPA+";;
|
||||
10) MODE="EVDO rev. 0";;
|
||||
11) MODE="EVDO rev. A";;
|
||||
12) MODE="EVDO rev. B";;
|
||||
13) MODE="1xRTT";;
|
||||
14) MODE="UMB";;
|
||||
15) MODE="1xEVDV";;
|
||||
16) MODE="3xRTT";;
|
||||
17) MODE="HSPA+64QAM";;
|
||||
18) MODE="HSPA+MIMO";;
|
||||
19) MODE="LTE";;
|
||||
21) MODE="IS95A";;
|
||||
22) MODE="IS95B";;
|
||||
23) MODE="CDMA1x";;
|
||||
24) MODE="EVDO rev. 0";;
|
||||
25) MODE="EVDO rev. A";;
|
||||
26) MODE="EVDO rev. B";;
|
||||
27) MODE="Hybrydowa CDMA1x";;
|
||||
28) MODE="Hybrydowa EVDO rev. 0";;
|
||||
29) MODE="Hybrydowa EVDO rev. A";;
|
||||
30) MODE="Hybrydowa EVDO rev. B";;
|
||||
31) MODE="EHRPD rev. 0";;
|
||||
32) MODE="EHRPD rev. A";;
|
||||
33) MODE="EHRPD rev. B";;
|
||||
34) MODE="Hybrydowa EHRPD rev. 0";;
|
||||
35) MODE="Hybrydowa EHRPD rev. A";;
|
||||
36) MODE="Hybrydowa EHRPD rev. B";;
|
||||
41) MODE="WCDMA (UMTS)";;
|
||||
42) MODE="HSDPA";;
|
||||
43) MODE="HSUPA";;
|
||||
44) MODE="HSPA";;
|
||||
45) MODE="HSPA+";;
|
||||
46) MODE="DC-HSPA+";;
|
||||
61) MODE="TD SCDMA";;
|
||||
62) MODE="TD HSDPA";;
|
||||
63) MODE="TD HSUPA";;
|
||||
64) MODE="TD HSPA";;
|
||||
65) MODE="TD HSPA+";;
|
||||
81) MODE="802.16E";;
|
||||
101) MODE="LTE";;
|
||||
*) MODE="-";;
|
||||
esac
|
||||
|
||||
if [ "x$MODE" = "xLTE" ]; then
|
||||
RSRP=$(getvaluens device-signal rsrp)
|
||||
SINR=$(getvaluens device-signal sinr)
|
||||
RSRQ=$(getvaluens device-signal rsrq)
|
||||
fi
|
||||
|
||||
MODEL=$(getvalue device-information DeviceName)
|
||||
if [ -n "$MODEL" ]; then
|
||||
class=$(getvalue device-information Classify)
|
||||
MODEL="Huawei $MODEL ($class)"
|
||||
else
|
||||
MODEL=$(getvalue device-basic_information devicename)
|
||||
class=$(getvalue device-basic_information classify)
|
||||
[ -n "$MODEL" ] && MODEL="Huawei $MODEL ($class)"
|
||||
fi
|
||||
|
||||
FW=$(getvalue device-information SoftwareVersion)
|
||||
if [ -n "$FW" ]; then
|
||||
rev=$(getvalue device-information HardwareVersion)
|
||||
FW="$rev / $FW"
|
||||
fi
|
||||
|
||||
COPSA=$(getvaluen net-current-plmn Numeric)
|
||||
COPSB=$(echo "${COPSA}" | cut -c1-3)
|
||||
COPSC=$(echo -n $COPSA | tail -c 2)
|
||||
COPS_MCC="$COPSB"
|
||||
COPS_MNC="$COPSC"
|
||||
|
||||
COPS=$(getvalue net-current-plmn ShortName)
|
||||
|
||||
LAC_HEX=$(getvalue net-signal-para Lac)
|
||||
if [ -z "$LAC_HEX" ]; then
|
||||
/usr/bin/wget -t 3 -O /tmp/add-param "http://$IP/config/deviceinformation/add_param.xml" > /dev/null 2>&1
|
||||
LAC_HEX=$(getvalue add-param lac)
|
||||
rm /tmp/add-param
|
||||
fi
|
||||
if [ -z "$LAC_HEX" ]
|
||||
then
|
||||
LAC_HEX='-'
|
||||
fi
|
||||
|
||||
CID_HEX=$(getvalue net-signal-para CellID)
|
||||
if [ -z "$CID_HEX" ]; then
|
||||
CID_HEX=$(getvalue device-signal cell_id)
|
||||
[ -n "$CID_HEX" ] && CID_HEX=$(printf %0X $CID_HEX)
|
||||
fi
|
||||
|
||||
if [ -z "$CID_HEX" ]
|
||||
then
|
||||
CID_HEX='-'
|
||||
fi
|
||||
|
||||
rm $cookie
|
||||
break
|
62
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/hilink/zte.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# (c) 2010-2021 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
#
|
||||
# (c) 2021 modified by Rafał Wabik - IceG - From eko.one.pl forum
|
||||
#
|
||||
|
||||
IP=$1
|
||||
[ -z "$IP" ] && exit 0
|
||||
|
||||
T=$(mktemp)
|
||||
wget -q -O $T "http://$IP/goform/goform_get_cmd_process?multi_data=1&cmd=manufacturer_name,model_name,network_provider,network_type,lte_rsrp,lte_rsrq,lte_rssi,lte_snr,cell_id,lac_code,hmcc,hmnc,rmcc,rmnc,rssi,rscp,ecio"
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
json_load "$(cat $T)"
|
||||
|
||||
json_get_vars manufacturer_name model_name network_provider network_type lte_rsrp lte_rsrq lte_rssi lte_snr cell_id lac_code hmcc hmnc rmcc rmnc rssi rscp ecio
|
||||
|
||||
if [ -n "$lte_rssi" ]; then
|
||||
RSSI=$lte_rssi
|
||||
fi
|
||||
if [ -n "$rssi" ]; then
|
||||
CSQ=$(((rssi+113)/2))
|
||||
CSQ_PER=$(($CSQ * 100/31))
|
||||
else
|
||||
CSQ=0
|
||||
CSQ_PER=0
|
||||
fi
|
||||
echo "+CSQ: $CSQ,99"
|
||||
|
||||
MODEL=$manufacturer_name $model_name
|
||||
|
||||
MODE=$network_type
|
||||
|
||||
echo "^SYSINFOEX:x,x,x,x,,x,\"$network_type\",x,\"$network_type\""
|
||||
|
||||
if [ -n "$hmcc" ]; then
|
||||
COPS_MCC==$(printf "%03d" $hmcc)
|
||||
else
|
||||
[ -n "$rmcc" ] && COPS_MCC==$(printf "%03d" $rmcc)
|
||||
fi
|
||||
|
||||
if [ -n "$hmnc" ]; then
|
||||
COPS_MNC=$(printf "%02d" $hmnc)
|
||||
else
|
||||
[ -n "$rmnc" ] && COPS_MNC=$(printf "%02d" $rmnc)
|
||||
fi
|
||||
echo "+COPS: 0,2,\"$mcc$mnc\",x"
|
||||
|
||||
if [ "x$network_type" = "xLTE" ]; then
|
||||
echo "^LTERSRP: $lte_rsrp,$lte_rsrq"
|
||||
RSRP=$lte_rsrp
|
||||
RSRQ=$lte_rsrq
|
||||
else
|
||||
echo "^CSNR: $rscp,$ecio"
|
||||
fi
|
||||
|
||||
echo "+CREG: 2,1,\"$lac_code\",\"$cell_id\""
|
||||
CID_HEX=$cell_id
|
||||
LAC_HEX=$lac_code
|
||||
|
||||
rm $T
|
51
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/info.gcom
Normal file
@ -0,0 +1,51 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.01
|
||||
waitquiet 0.01 0.01
|
||||
|
||||
let $c="AT+CSQ^m"
|
||||
let $r="+CSQ"
|
||||
gosub readatcmd
|
||||
|
||||
let $c="AT+COPS=3,0;+COPS?^m"
|
||||
let $r="+COPS"
|
||||
gosub readatcmd
|
||||
|
||||
let $c="AT+COPS=3,2;+COPS?^m"
|
||||
let $r="+COPS"
|
||||
gosub readatcmd
|
||||
|
||||
let $c="AT+CREG=2;+CREG?^m"
|
||||
let $r="+CREG"
|
||||
gosub readatcmd
|
||||
|
||||
let $c="AT+CPIN?^m"
|
||||
let $r="+CPIN"
|
||||
gosub readatcmd
|
||||
|
||||
exit 0
|
||||
|
||||
:readatcmd
|
||||
let i=15
|
||||
send $c
|
||||
:loop
|
||||
get 0.1 "^m" $s
|
||||
let l=len($r)
|
||||
if len($s) < l goto loop1
|
||||
if $mid($s,1,l) <> $r goto loop1
|
||||
print $s
|
||||
return
|
||||
|
||||
:loop1
|
||||
if len($s) < 2 goto loop2
|
||||
if $mid($s,1,2) = "ER" return
|
||||
if $mid($s,1,2) = "CO" return
|
||||
if len($s) < 10 goto loop2
|
||||
if $mid($s,1,10) != "+CME ERROR" goto loop2
|
||||
print $s
|
||||
return
|
||||
:loop2
|
||||
if i = 0 exit 0
|
||||
let i=i-1
|
||||
goto loop
|
1751
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/mccmnc.dat
Normal file
128
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/03f00857
Normal file
@ -0,0 +1,128 @@
|
||||
# Telit LN940 (QMI) / Telit LN940 (MBIM) / HP lt4220 (MBIM) / HP lt4220 (QMI)
|
||||
|
||||
O=$(sms_tool -D -d $DEVICE at "AT^CA_INFO?;^RFSTS?;+TEMP")
|
||||
|
||||
TR=$(echo "$O" |grep -A2 RFSTS: | awk 'NR ==2{print $0}')
|
||||
|
||||
if [ "$MODE" = "LTE" ]; then
|
||||
RSRP=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$3}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSRQ=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$5}')
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$16*2-20}')
|
||||
else
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$6}')
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\PCC info: /{print $2}' | sed 's/Band is //g')
|
||||
[ -z "$T" ] && T=$(echo "$O" | awk -F[,] '/^\PCC info: /{print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
PC=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="LTE | $(band $PC)"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC1 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC1=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE/LTE/LTE_A} / "$(band ${SC1} "")
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC2 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC2=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE} / "$(band ${SC2} "")
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A ,')
|
||||
|
||||
# Primary band
|
||||
T1=$(echo "$O" | awk '/PCC/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T1" ]; then
|
||||
T2=$(echo "$O" | awk '/PCC/{print $8}' | sed -e 's/Band_width//g')
|
||||
PBAND="$(band ${T1/B/} "") @$T2 MHz"
|
||||
EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S1)
|
||||
T3=$(echo "$O" | awk '/SCC1/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T3" ]; then
|
||||
T4=$(echo "$O" | awk '/SCC1/{print $8}' | sed -e 's/Band_width//g')
|
||||
S1BAND="$(band ${T3/B/} "") @$T4 MHz"
|
||||
# S1EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S1PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S2)
|
||||
T5=$(echo "$O" | awk '/SCC2/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T5" ]; then
|
||||
T6=$(echo "$O" | awk '/SCC2/{print $8}' | sed -e 's/Band_width//g')
|
||||
S2BAND="$(band ${T5/B/} "") @$T6 MHz"
|
||||
# S2EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S2PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F [:] '/tsens_tz_sensor0:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP=$(echo "$T °C")
|
||||
fi
|
||||
|
||||
# Cell ID & LAC & TAC
|
||||
LAC_HEX=$(printf "%X" $LAC_DEC)
|
||||
if [ -n "$LAC_DEC" ]; then
|
||||
TAC_HEX=$LAC_HEX
|
||||
fi
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=03f0 ProdID=0857' '{print $2}' | cut -c-1220)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Model
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=03f0 ProdID=0857' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}')
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | awk -F " " '/GSN /{print $2}')
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | awk -F " " '/CIMI /{print $2}')
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)
|
128
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/03f00a57
Normal file
@ -0,0 +1,128 @@
|
||||
# Telit LN940 (QMI) / Telit LN940 (MBIM) / HP lt4220 (MBIM) / HP lt4220 (QMI)
|
||||
|
||||
O=$(sms_tool -D -d $DEVICE at "AT^CA_INFO?;^RFSTS?;+TEMP")
|
||||
|
||||
TR=$(echo "$O" |grep -A2 RFSTS: | awk 'NR ==2{print $0}')
|
||||
|
||||
if [ "$MODE" = "LTE" ]; then
|
||||
RSRP=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$3}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSRQ=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$5}')
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$16*2-20}')
|
||||
else
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$6}')
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\PCC info: /{print $2}' | sed 's/Band is //g')
|
||||
[ -z "$T" ] && T=$(echo "$O" | awk -F[,] '/^\PCC info: /{print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
PC=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="LTE | $(band $PC)"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC1 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC1=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE/LTE/LTE_A} / "$(band ${SC1} "")
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC2 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC2=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE} / "$(band ${SC2} "")
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A ,')
|
||||
|
||||
# Primary band
|
||||
T1=$(echo "$O" | awk '/PCC/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T1" ]; then
|
||||
T2=$(echo "$O" | awk '/PCC/{print $8}' | sed -e 's/Band_width//g')
|
||||
PBAND="$(band ${T1/B/} "") @$T2 MHz"
|
||||
EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S1)
|
||||
T3=$(echo "$O" | awk '/SCC1/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T3" ]; then
|
||||
T4=$(echo "$O" | awk '/SCC1/{print $8}' | sed -e 's/Band_width//g')
|
||||
S1BAND="$(band ${T3/B/} "") @$T4 MHz"
|
||||
# S1EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S1PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S2)
|
||||
T5=$(echo "$O" | awk '/SCC2/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T5" ]; then
|
||||
T6=$(echo "$O" | awk '/SCC2/{print $8}' | sed -e 's/Band_width//g')
|
||||
S2BAND="$(band ${T5/B/} "") @$T6 MHz"
|
||||
# S2EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S2PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F [:] '/tsens_tz_sensor0:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP=$(echo "$T °C")
|
||||
fi
|
||||
|
||||
# Cell ID & LAC & TAC
|
||||
LAC_HEX=$(printf "%X" $LAC_DEC)
|
||||
if [ -n "$LAC_DEC" ]; then
|
||||
TAC_HEX=$LAC_HEX
|
||||
fi
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=03f0 ProdID=0a57' '{print $2}' | cut -c-1220)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Model
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=03f0 ProdID=0a57' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}')
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | awk -F " " '/GSN /{print $2}')
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | awk -F " " '/CIMI /{print $2}')
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)
|
113
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/03f0581d
Normal file
@ -0,0 +1,113 @@
|
||||
# Huawei E3272/E3372/E3276
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at^chiptemp?;^hcsq?")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
MODE="$T"
|
||||
|
||||
case "$MODE" in
|
||||
WCDMA*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
RSCP=$(awk 'BEGIN {print -121 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSCP":"'$RSCP' dBm"}'
|
||||
ECIO=$(awk 'BEGIN {print -32.5 + '$PARAM3'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"ECIO":"'$ECIO' dB"}'
|
||||
;;
|
||||
LTE*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
PARAM4=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $6}' | xargs)
|
||||
RSRP=$(awk 'BEGIN {print -141 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRP":"'$RSRP' dBm"}'
|
||||
SINR=$(awk 'BEGIN {print -20.2 + '$PARAM3'/5}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"SINR":"'$SINR' dB"}'
|
||||
RSRQ=$(awk 'BEGIN {print -20 + '$PARAM4'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRQ":"'$RSRQ' dB"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
MODELB=$(echo $DEV2 | awk -F 'Manufacturer:|Revision:' '{print $2}'| xargs)
|
||||
MODELC=$(echo $MODELB | sed 's/Model://' | xargs)
|
||||
MODEL=$(echo $MODELC | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')
|
||||
FW=$(echo $DEV2 | awk -F 'Revision:|IMEI' '{print $2}'| xargs)
|
||||
|
||||
# Protocol
|
||||
# Driver=qmi_wwan & Driver=cdc_mbim & Driver=cdc_ether & Driver=huawei_cdc_ncm
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=12d1 ProdID=1506' '{print $2}' | cut -c-1104)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
elif echo "$PVCUT" | grep -q "cdc_ncm"
|
||||
then
|
||||
PROTO="ncm"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed 's/AT+GSN//g' | xargs)
|
||||
if [ -n "NR_I" ]
|
||||
then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT^ICCID?")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# DL / UL / Band
|
||||
OTB=$(sms_tool -d $DEVICE at "AT^HFREQINFO?")
|
||||
TBX=$(echo "$OTB" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs)
|
||||
TB=$(echo "$TBX" | cut -d ',' -f3-3 )
|
||||
|
||||
TDL=$(echo "$TBX" | cut -d ',' -f6-6 )
|
||||
DL=$(($TDL/1000))
|
||||
|
||||
TUL=$(echo "$TBX" | cut -d ',' -f9-9 )
|
||||
UL=$(($TUL/1000))
|
||||
|
||||
ULBW="UL: @$UL MHz"
|
||||
DLBW="DL: @$DL MHz"
|
||||
|
||||
PBAND="$(band $TB "") $DLBW $ULBW"
|
||||
EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 )
|
||||
PCI="-"
|
||||
|
||||
# LAC & TAC
|
||||
T_HEX=$LAC_HEX
|
||||
T_DEC=$LAC_DEC
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}')
|
||||
if [ "x$T" != "x0.0" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
TEMP="$T °C"
|
||||
#ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
@ -0,0 +1,29 @@
|
||||
# Qualcomm CDMA Technologies MSM
|
||||
|
||||
# Modem
|
||||
MODEL="Qualcomm CDMA Technologies MSM"
|
||||
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+CGMR")
|
||||
FW=$(echo $FWA | cut -c 9- | sed s/"OK"// | xargs)
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8- | sed s/"OK"// | xargs)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9- | sed s/"OK"// | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\ICCID:/{print $2}' | sed s/"OK"// | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
117
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/05c69215
Normal file
@ -0,0 +1,117 @@
|
||||
# Quectel EC20-E
|
||||
# Quectel EC25
|
||||
|
||||
OCT=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$OCT" | awk -F[,:] '/^\+QTEMP/ {t=$2*1;if($3*1>t)t=$3*1;if($4*1>t)t=$4*1;printf "%d", t}')
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qnwinfo;+qeng=\"servingcell\";+qspn")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO/ {print $2"/"$4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
B=$(echo $T | sed 's/.*LTE BAND \(.*\)/\1/')
|
||||
MODE="LTE $(band ${B})"
|
||||
MAINCUT="$(band ${B})"
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ] || [ "x$T" = "x4G" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0) T1="1.4";;
|
||||
1) T1="3";;
|
||||
2) T1="5";;
|
||||
3) T1="10";;
|
||||
4) T1="15";;
|
||||
5) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0) T1="1.4";;
|
||||
1) T1="3";;
|
||||
2) T1="5";;
|
||||
3) T1="10";;
|
||||
4) T1="15";;
|
||||
5) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
DLBW="DL: @$T1 MHz"
|
||||
PBAND="$MAINCUT $DLBW $ULBW"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}')
|
||||
PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $10}')
|
||||
EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $17}')
|
||||
RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}')
|
||||
RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}')
|
||||
RSRQ=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", $1*0.2-20}')
|
||||
SINR=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEVV=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEVV | awk -F 'Revision:' '{print $2}'| xargs)
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $1}'| xargs)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $2}'| xargs)
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=05c6 ProdID=9215' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
@ -0,0 +1,85 @@
|
||||
# Sierra Wireless 320u
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at!gstatus?")
|
||||
|
||||
T=$(echo "$O" | awk '/^LTE band:/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
case "$T" in
|
||||
*"B1") MODE=$(band 1 "LTE ");;
|
||||
*"B3") MODE=$(band 3 "LTE ");;
|
||||
*"B5") MODE=$(band 5 "LTE ");;
|
||||
*"B7") MODE=$(band 7 "LTE ");;
|
||||
*"B8") MODE=$(band 8 "LTE ");;
|
||||
*) MODE="LTE ${T}";;
|
||||
esac
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^RSSI/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSSI="${T// //}"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSSI":"'${T// //}' dBm"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^RSRP/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRP="${T// //}"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRP":"'${T// //}' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^RSRQ/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRQ="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$T' dB"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^SINR/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SINR="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"SINR":"'$T' dB"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
||||
|
||||
TAC_HEX=$(echo "$O" |awk -F: '/TAC:/ {print $3}' | awk '{ print $1 }' | xargs)
|
||||
TAC_DEC=$(echo "$O" | sed 's/[()]//g' |awk -F: '/TAC:/ {print $3}' | awk '{ print $2 }' | xargs)
|
||||
|
||||
|
||||
|
||||
BW=$(echo "$O" |awk -F: '/LTE bw:/ {print $3}' | xargs)
|
||||
RXCH=$(echo "$O" |awk -F: '/LTE Rx chan:/ {print $2}' | cut -f1 | xargs)
|
||||
TXCH=$(echo "$O" |awk -F: '/LTE Tx chan:/ {print $3}' | cut -f1 | xargs)
|
||||
|
||||
PBAND="RxCh:$RXCH / TxCh:$TXCH / Bw:$BW"
|
||||
#EARFCN=$(echo "$O" |awk -F: '/^LTE Rx chan:/ {print $2}' | cut -f1 | xargs)
|
||||
PCI="-"
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
MODELB=$(echo $DEV2 | awk -F 'Manufacturer:|Revision:' '{print $2}'| xargs)
|
||||
MODEL=$(echo $MODELB | sed 's/Model://' | xargs)
|
||||
|
||||
FW=$(echo $DEV2 | awk -F 'Revision:|IMEI' '{print $2}'| xargs)
|
||||
NR_IMEI=$(echo "$OF" | awk '/^IMEI:/ {print $2}' | xargs)
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_ICCID=$(echo "$O" | awk '/^ICCID/ {print $2}')
|
||||
|
||||
PROTO=sierra
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
# Sierra Wireless MC7710
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at!gstatus?")
|
||||
|
||||
T=$(echo "$O" | awk '/^LTE band:/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
case "$T" in
|
||||
*"B1") MODE=$(band 1 "LTE ");;
|
||||
*"B3") MODE=$(band 3 "LTE ");;
|
||||
*"B7") MODE=$(band 7 "LTE ");;
|
||||
*"B8") MODE=$(band 8 "LTE ");;
|
||||
*"B20") MODE=$(band 20 "LTE ");;
|
||||
*) MODE="LTE ${T}";;
|
||||
esac
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^RSSI/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSSI="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSSI":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^RSRP/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRP="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^RSRQ/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRQ="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$T' dB"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^SINR/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SINR="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"SINR":"'$T' dB"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
104
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/11999071
Normal file
@ -0,0 +1,104 @@
|
||||
# DW5809e Dell Wireless 5809e Gobi 4G LTE Mobile Broadband Card (EM7305)
|
||||
# DW5811e Snapdragon X7 LTE (EM7455B)
|
||||
# Sierra Wireless EM7455
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at!gstatus?")
|
||||
|
||||
T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}' | grep -oE "\d+\.?\d{0,2}")
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk '/.*TAC:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^PCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && RSSI="${T// //}"
|
||||
T=$(echo "$O" | awk '/^PCC.*RSRP/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && RSRP="${T// //}"
|
||||
T=$(echo "$O" | awk '/^RSRQ/ {print $3}')
|
||||
[ -n "$T" ] && RSRQ="$T"
|
||||
T=$(echo "$O" | awk '/^SINR/ {print $3}')
|
||||
[ -n "$T" ] && SINR="$T"
|
||||
|
||||
T=$(echo "$O" | awk '/^LTE band:/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE band:/ {print $6}')
|
||||
PBAND="$(band ${T/B/}) @${T1} MHz"
|
||||
MODE="$MODE $(band ${T/B/})"
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^LTE Rx chan:/ {print $4}')
|
||||
# [ -n "$T" ] && addon 34 "EARFCN DL" "$T"
|
||||
T=$(echo "$O" | awk '/^LTE Rx chan:/ {print $8}')
|
||||
# [ -n "$T" ] && addon 34 "EARFCN UL" "$T"
|
||||
|
||||
T=$(echo "$O" | awk -F: '/^LTE CA state:.*ACTIVE/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE Scell bw:/ {print $3}')
|
||||
if [ -n "$T1" ]; then
|
||||
S1BAND="$(band ${T/B/}) @${T1#bw:} MHz"
|
||||
else
|
||||
S1BAND="$(band ${T/B/})"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T/B/})"
|
||||
|
||||
T=$(echo "$O" | awk '/.*LTE Scell chan:/ {print $7}')
|
||||
[ -n "$T" ] && S1EARFCN="${T#chan:}"
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && RSSI="${T// //} dBm"
|
||||
T=$(echo "$O" | awk '/^SCC.*RSRP/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && RSRP="${T// //} dBm"
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+CGMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+CGMR "//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM "//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI "// | cut -f1 -d",")
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+CGSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$O" | awk -F[,:] '/^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1199 ProdID=9071' '{print $2}' | cut -c-1100)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
147
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/119990d3
Normal file
@ -0,0 +1,147 @@
|
||||
# Sierra Wireless EM9190
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at!gstatus?")
|
||||
|
||||
T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}')
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
|
||||
T=$(echo "$O" | awk '/^System mode:/ {print $3}')
|
||||
case $T in
|
||||
"LTE")
|
||||
MODE="LTE"
|
||||
;;
|
||||
"ENDC")
|
||||
MODE="5G NSA"
|
||||
;;
|
||||
esac
|
||||
|
||||
T=$(echo "$O" | awk '/.*TAC:/ {print $6}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^PCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && && RSSI="${T// //}"
|
||||
T=$(echo "$O" | awk '/^PCC.*RSRP/ {print $8}' | xargs)
|
||||
[ -n "$T" ] && RSRP="${T// //}"
|
||||
T=$(echo "$O" | awk '/^RSRQ/ {print $3}')
|
||||
[ -n "$T" ] && RSRQ="$T"
|
||||
T=$(echo "$O" | awk '/^SINR/ {print $3}')
|
||||
[ -n "$T" ] && SINR="$T"
|
||||
|
||||
T=$(echo "$O" | awk '/^LTE band:/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE band:/ {print $6}')
|
||||
PBAND="$(band ${T/B/}) @${T1} MHz"
|
||||
MODE="$MODE $(band ${T/B/})"
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^LTE Rx chan:/ {print $4}')
|
||||
# [ -n "$T" ] && addon 34 "EARFCN DL" "$T"
|
||||
T=$(echo "$O" | awk '/^LTE Rx chan:/ {print $8}')
|
||||
# [ -n "$T" ] && addon 34 "EARFCN UL" "$T"
|
||||
|
||||
T=$(echo "$O" | awk -F: '/^LTE SCC1 state:.*ACTIVE/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE SCC1 bw/ {print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
S1BAND=$(band ${T/B/}) @${T1} MHz"
|
||||
else
|
||||
S1BAND="$(band ${T/B/})"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T/B/})"
|
||||
|
||||
T=$(echo "$O" | awk '/.*LTE SCC1 Rx chan:/ {print $11}')
|
||||
# [ -n "$T" ] && addon 54 "(S1) EARFCN DL" "${T}"
|
||||
T=$(echo "$O" | awk '/.*LTE SCC1 Tx chan:/ {print $10}')
|
||||
# [ -n "$T" ] && addon 54 "(S1) EARFCN UL" "${T}"
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC1.*RSSI/ {print $4}' | xargs)
|
||||
# [ -n "$T" ] && addon 55 "(S1) RSSI" "${T// //} dBm"
|
||||
T=$(echo "$O" | awk '/^SCC1.*RSRP/ {print $8}' | xargs)
|
||||
# [ -n "$T" ] && addon 56 "(S1) RSRP" "${T// //} dBm"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/^LTE SCC2 state:.*ACTIVE/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE SCC2 bw/ {print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
S2BAND="$(band ${T/B/}) @${T1} MHz"
|
||||
else
|
||||
S2BAND="$(band ${T/B/})"
|
||||
fi
|
||||
MODE="$MODE / $(band ${T/B/})"
|
||||
|
||||
T=$(echo "$O" | awk '/.*LTE SCC2 Rx chan:/ {print $11}')
|
||||
# [ -n "$T" ] && addon 64 "(S2) EARFCN DL" "${T}"
|
||||
T=$(echo "$O" | awk '/.*LTE SCC2 Tx chan:/ {print $10}')
|
||||
# [ -n "$T" ] && addon 64 "(S2) EARFCN UL" "${T}"
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC2.*RSSI/ {print $4}' | xargs)
|
||||
# [ -n "$T" ] && addon 65 "(S2) RSSI" "${T// //} dBm"
|
||||
T=$(echo "$O" | awk '/^SCC2.*RSRP/ {print $8}' | xargs)
|
||||
# [ -n "$T" ] && addon 66 "(S2) RSRP" "${T// //} dBm"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/^LTE SCC3 state:.*ACTIVE/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE SCC3 bw/ {print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
S3BAND"$(band ${T/B/}) @${T1} MHz"
|
||||
else
|
||||
S3BAND"$(band ${T/B/})"
|
||||
fi
|
||||
MODE="$MODE / $(band ${T/B/})"
|
||||
|
||||
T=$(echo "$O" | awk '/.*LTE SCC3 Rx chan:/ {print $11}')
|
||||
# [ -n "$T" ] && addon 74 "(S3) EARFCN DL" "${T}"
|
||||
T=$(echo "$O" | awk '/.*LTE SCC3 Tx chan:/ {print $10}')
|
||||
# [ -n "$T" ] && addon 74 "(S3) EARFCN UL" "${T}"
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC3.*RSSI/ {print $4}' | xargs)
|
||||
# [ -n "$T" ] && addon 75 "(S3) RSSI" "${T// //} dBm"
|
||||
T=$(echo "$O" | awk '/^SCC3.*RSRP/ {print $8}' | xargs)
|
||||
# [ -n "$T" ] && addon 76 "(S3) RSRP" "${T// //} dBm"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC. NR5G band:/ {print $4}')
|
||||
if [ -n "$T" ] && [ "$T" != "---" ]; then
|
||||
MODE="$MODE / $(band5g ${T/n/})"
|
||||
T1=$(echo "$O" | awk '/^SCC.*SCC. NR5G bw:/ {print $8}')
|
||||
if [ -n "$T1" ]; then
|
||||
# addon 80 "5G band" "$(band5g ${T/n/}) @${T1} MHz"
|
||||
else
|
||||
# addon 80 "5G band" "$(band5g ${T/n/})"
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^SCC. NR5G Rx chan:/ {print $5}')
|
||||
# [ -n "$T" ] && addon 84 "EARFCN DL" "$T"
|
||||
T=$(echo "$O" | awk '/^SCC.*SCC. NR5G Tx chan:/ {print $10}')
|
||||
# [ -n "$T" ] && addon 84 "EARFCN UL" "$T"
|
||||
T=$(echo "$O" | awk '/^NR5G RSRP/ {print $4}')
|
||||
# [ -n "$T" ] && addon 86 "RSRP" "$T dBm"
|
||||
T=$(echo "$O" | awk '/^NR5G.*RSRQ/ {print $8}')
|
||||
# [ -n "$T" ] && addon 87 "RSRQ" "$T dB"
|
||||
T=$(echo "$O" | awk '/^NR5G SINR/ {print $4}')
|
||||
# [ -n "$T" ] && addon 88 "RSRP" "$T dBm"
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1199 ProdID=90d3' '{print $2}' | cut -c-1100)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
122
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/12d11506
Normal file
@ -0,0 +1,122 @@
|
||||
# Huawei E3272/E3372/E3276
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at^chiptemp?;^hcsq?;^iccid?")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
MODE="$T"
|
||||
|
||||
case "$MODE" in
|
||||
WCDMA*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
RSCP=$(awk 'BEGIN {print -121 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSCP":"'$RSCP' dBm"}'
|
||||
ECIO=$(awk 'BEGIN {print -32.5 + '$PARAM3'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"ECIO":"'$ECIO' dB"}'
|
||||
;;
|
||||
LTE*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
PARAM4=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $6}' | xargs)
|
||||
RSRP=$(awk 'BEGIN {print -141 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRP":"'$RSRP' dBm"}'
|
||||
SINR=$(awk 'BEGIN {print -20.2 + '$PARAM3'/5}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"SINR":"'$SINR' dB"}'
|
||||
RSRQ=$(awk 'BEGIN {print -20 + '$PARAM4'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRQ":"'$RSRQ' dB"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
MODELB=$(echo $DEV2 | awk -F 'Manufacturer:|Revision:' '{print $2}'| xargs)
|
||||
MODELC=$(echo $MODELB | sed 's/Model://' | xargs)
|
||||
MODEL=$(echo $MODELC | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')
|
||||
FW=$(echo $DEV2 | awk -F 'Revision:|IMEI' '{print $2}'| xargs)
|
||||
|
||||
# Protocol
|
||||
# Driver=qmi_wwan & Driver=cdc_mbim & Driver=cdc_ether & Driver=huawei_cdc_ncm
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=12d1 ProdID=1506' '{print $2}' | cut -c-1104)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
elif echo "$PVCUT" | grep -q "cdc_ncm"
|
||||
then
|
||||
PROTO="ncm"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
OI=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$OI" | sed 's/AT+GSN//g' | xargs)
|
||||
if [ -n "NR_I" ]
|
||||
then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
OC=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$OC" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
XFR=$(sms_tool -d $DEVICE at "at^hfreqinfo?")
|
||||
XFRCOUNT=$(echo -n "$XFR" | wc -c)
|
||||
|
||||
if [ -n "$XFR" ] && [ "$XFRCOUNT" -gt "15" ]; then
|
||||
|
||||
# DL / UL / Band
|
||||
TBX=$(echo "$XFR" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs)
|
||||
TB=$(echo "$TBX" | cut -d ',' -f3-3 )
|
||||
|
||||
TDL=$(echo "$TBX" | cut -d ',' -f6-6 )
|
||||
DL=$(($TDL/1000))
|
||||
|
||||
TUL=$(echo "$TBX" | cut -d ',' -f9-9 )
|
||||
UL=$(($TUL/1000))
|
||||
|
||||
ULBW="UL: @$UL MHz"
|
||||
DLBW="DL: @$DL MHz"
|
||||
|
||||
PBAND="$(band $TB "") $DLBW $ULBW"
|
||||
EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 )
|
||||
PCI="-"
|
||||
|
||||
if [[ "$MODE" == *"LTE"* ]] && [ -n "$TB" ]; then
|
||||
MODE="LTE | "$(band $TB "")
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# LAC & TAC
|
||||
T_HEX=$LAC_HEX
|
||||
T_DEC=$LAC_DEC
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}')
|
||||
if [ "x$T" != "x0.0" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
TEMP="$T °C"
|
||||
#ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
122
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/12d1155e
Normal file
@ -0,0 +1,122 @@
|
||||
# Huawei E3272/E3372/E3276
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at^chiptemp?;^hcsq?;^iccid?")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
MODE="$T"
|
||||
|
||||
case "$MODE" in
|
||||
WCDMA*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
RSCP=$(awk 'BEGIN {print -121 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSCP":"'$RSCP' dBm"}'
|
||||
ECIO=$(awk 'BEGIN {print -32.5 + '$PARAM3'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"ECIO":"'$ECIO' dB"}'
|
||||
;;
|
||||
LTE*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
PARAM4=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $6}' | xargs)
|
||||
RSRP=$(awk 'BEGIN {print -141 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRP":"'$RSRP' dBm"}'
|
||||
SINR=$(awk 'BEGIN {print -20.2 + '$PARAM3'/5}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"SINR":"'$SINR' dB"}'
|
||||
RSRQ=$(awk 'BEGIN {print -20 + '$PARAM4'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRQ":"'$RSRQ' dB"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
MODELB=$(echo $DEV2 | awk -F 'Manufacturer:|Revision:' '{print $2}'| xargs)
|
||||
MODELC=$(echo $MODELB | sed 's/Model://' | xargs)
|
||||
MODEL=$(echo $MODELC | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')
|
||||
FW=$(echo $DEV2 | awk -F 'Revision:|IMEI' '{print $2}'| xargs)
|
||||
|
||||
# Protocol
|
||||
# Driver=qmi_wwan & Driver=cdc_mbim & Driver=cdc_ether & Driver=huawei_cdc_ncm
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=12d1 ProdID=155e' '{print $2}' | cut -c-1104)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
elif echo "$PVCUT" | grep -q "cdc_ncm"
|
||||
then
|
||||
PROTO="ncm"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
OI=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$OI" | sed 's/AT+GSN//g' | xargs)
|
||||
if [ -n "NR_I" ]
|
||||
then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
OC=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$OC" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
XFR=$(sms_tool -d $DEVICE at "at^hfreqinfo?")
|
||||
XFRCOUNT=$(echo -n "$XFR" | wc -c)
|
||||
|
||||
if [ -n "$XFR" ] && [ "$XFRCOUNT" -gt "15" ]; then
|
||||
|
||||
# DL / UL / Band
|
||||
TBX=$(echo "$XFR" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs)
|
||||
TB=$(echo "$TBX" | cut -d ',' -f3-3 )
|
||||
|
||||
TDL=$(echo "$TBX" | cut -d ',' -f6-6 )
|
||||
DL=$(($TDL/1000))
|
||||
|
||||
TUL=$(echo "$TBX" | cut -d ',' -f9-9 )
|
||||
UL=$(($TUL/1000))
|
||||
|
||||
ULBW="UL: @$UL MHz"
|
||||
DLBW="DL: @$DL MHz"
|
||||
|
||||
PBAND="$(band $TB "") $DLBW $ULBW"
|
||||
EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 )
|
||||
PCI="-"
|
||||
|
||||
if [[ "$MODE" == *"LTE"* ]] && [ -n "$TB" ]; then
|
||||
MODE="LTE | "$(band $TB "")
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# LAC & TAC
|
||||
T_HEX=$LAC_HEX
|
||||
T_DEC=$LAC_DEC
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}')
|
||||
if [ "x$T" != "x0.0" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
TEMP="$T °C"
|
||||
#ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
113
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/12d1156c
Normal file
@ -0,0 +1,113 @@
|
||||
# Huawei E3272/E3372/E3276
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at^chiptemp?;^hcsq?")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
MODE="$T"
|
||||
|
||||
case "$MODE" in
|
||||
WCDMA*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
RSCP=$(awk 'BEGIN {print -121 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSCP":"'$RSCP' dBm"}'
|
||||
ECIO=$(awk 'BEGIN {print -32.5 + '$PARAM3'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"ECIO":"'$ECIO' dB"}'
|
||||
;;
|
||||
LTE*)
|
||||
PARAM2=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $4}' | xargs)
|
||||
PARAM3=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $5}' | xargs)
|
||||
PARAM4=$(echo "$O" | awk -F[,:] '/^\^HCSQ:/ {print $6}' | xargs)
|
||||
RSRP=$(awk 'BEGIN {print -141 + '$PARAM2'}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRP":"'$RSRP' dBm"}'
|
||||
SINR=$(awk 'BEGIN {print -20.2 + '$PARAM3'/5}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"SINR":"'$SINR' dB"}'
|
||||
RSRQ=$(awk 'BEGIN {print -20 + '$PARAM4'/2}')
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"RSRQ":"'$RSRQ' dB"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
MODELB=$(echo $DEV2 | awk -F 'Manufacturer:|Revision:' '{print $2}'| xargs)
|
||||
MODELC=$(echo $MODELB | sed 's/Model://' | xargs)
|
||||
MODEL=$(echo $MODELC | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')
|
||||
FW=$(echo $DEV2 | awk -F 'Revision:|IMEI' '{print $2}'| xargs)
|
||||
|
||||
# Protocol
|
||||
# Driver=qmi_wwan & Driver=cdc_mbim & Driver=cdc_ether & Driver=huawei_cdc_ncm
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=12d1 ProdID=1506' '{print $2}' | cut -c-1104)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
elif echo "$PVCUT" | grep -q "cdc_ncm"
|
||||
then
|
||||
PROTO="ncm"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed 's/AT+GSN//g' | xargs)
|
||||
if [ -n "NR_I" ]
|
||||
then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT^ICCID?")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# DL / UL / Band
|
||||
OTB=$(sms_tool -d $DEVICE at "AT^HFREQINFO?")
|
||||
TBX=$(echo "$OTB" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs)
|
||||
TB=$(echo "$TBX" | cut -d ',' -f3-3 )
|
||||
|
||||
TDL=$(echo "$TBX" | cut -d ',' -f6-6 )
|
||||
DL=$(($TDL/1000))
|
||||
|
||||
TUL=$(echo "$TBX" | cut -d ',' -f9-9 )
|
||||
UL=$(($TUL/1000))
|
||||
|
||||
ULBW="UL: @$UL MHz"
|
||||
DLBW="DL: @$DL MHz"
|
||||
|
||||
PBAND="$(band $TB "") $DLBW $ULBW"
|
||||
EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 )
|
||||
PCI="-"
|
||||
|
||||
# LAC & TAC
|
||||
T_HEX=$LAC_HEX
|
||||
T_DEC=$LAC_DEC
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}')
|
||||
if [ "x$T" != "x0.0" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
TEMP="$T °C"
|
||||
#ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
148
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/16907588
Normal file
@ -0,0 +1,148 @@
|
||||
# ASKEY WWHC050
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at\$qcai?;+ccputemp;+cgcelli;+cgnws")
|
||||
T=$(echo "$O" | awk 'BEGIN{FS="BEARER:"}/^\+CGCELLI/{print $2}' | awk 'BEGIN{FS=","}{print $1}')
|
||||
|
||||
case "$T" in
|
||||
"0x01"*)
|
||||
MODE="GPRS";;
|
||||
"0x02"*)
|
||||
MODE="EDGE";;
|
||||
"0x03"*)
|
||||
MODE="HSDPA";;
|
||||
"0x04"*)
|
||||
MODE="HSUPA";;
|
||||
"0x05"*)
|
||||
MODE="WCDMA";;
|
||||
"0x06"*)
|
||||
MODE="CDMA";;
|
||||
"0x07"*)
|
||||
MODE="EV-DO REV 0";;
|
||||
"0x08"*)
|
||||
MODE="EV-DO REV A";;
|
||||
"0x09"*)
|
||||
MODE="GSM";;
|
||||
"0x0a"*|"0x0A"*)
|
||||
MODE="EV-DO REV B";;
|
||||
"0x0b"*|"0x0B"*)
|
||||
MODE="LTE";;
|
||||
"0x0c"*|"0x0C"*)
|
||||
MODE="HSDPA+";;
|
||||
"0x0d"*|"0x0D"*)
|
||||
MODE="DC-HSDPA+";;
|
||||
esac
|
||||
|
||||
if [ $MODE != "LTE" ]; then
|
||||
O1=$(echo "$O" | grep CGCELLI | sed 's/+CGCELLI://')
|
||||
T1="$O1"
|
||||
while true; do
|
||||
T2=${T1%%,*}
|
||||
[ -z "$T2" ] && break
|
||||
if echo "$T2" | grep -q ":"; then
|
||||
F1=${T2%%:*}
|
||||
F2=${T2##*:}
|
||||
UNIT=""
|
||||
IGNORE=0
|
||||
case "$F1" in
|
||||
RSCP|RSRP|RSSI) UNIT=" dBm";;
|
||||
ECIO|SINR|RSRQ) UNIT=" dB";;
|
||||
LAC|PLMN|BEARER) IGNORE=1;;
|
||||
esac
|
||||
if [ $IGNORE -eq 0 ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"'$F1'":"'$F2''$UNIT'"}'
|
||||
fi
|
||||
fi
|
||||
if echo "$T1" | grep -q ","; then
|
||||
T2="${T2},"
|
||||
fi
|
||||
T1=$(echo "$T1" | sed 's/^'$T2'//')
|
||||
done
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"Band:1") MODE=$(band 1 "LTE ");;
|
||||
*"Band:3") MODE=$(band 3 "LTE ");;
|
||||
*"Band:7") MODE=$(band 7 "LTE ");;
|
||||
*"Band:8") MODE=$(band 8 "LTE ");;
|
||||
*"Band:20") MODE=$(band 20 "LTE ");;
|
||||
*) MODE="LTE ${T}";;
|
||||
esac
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,] '/CA:ADDED/{print $16}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"(S)Band:1") MODE="${MODE/LTE/LTE_A} / "$(band 1 "");;
|
||||
*"(S)Band:3") MODE="${MODE/LTE/LTE_A} / "$(band 3 "");;
|
||||
*"(S)Band:7") MODE="${MODE/LTE/LTE_A} / "$(band 7 "");;
|
||||
*"(S)Band:8") MODE="${MODE/LTE/LTE_A} / "$(band 8 "");;
|
||||
*"(S)Band:20") MODE="${MODE/LTE/LTE_A} / "$(band 20 "");;
|
||||
*) MODE="${MODE/LTE/LTE_A} / B${T}";;
|
||||
esac
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=${T##*:}
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $12}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRP="$RSRP / "${T##*:}" dBm"
|
||||
fi
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRP":"'$RSRP'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRQ=${T##*:}
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $13}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRQ="$RSRQ / "${T##*:}" dB"
|
||||
fi
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$RSRQ'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
RSSI=${T##*:}
|
||||
T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $14}')
|
||||
if [ -n "$T" ]; then
|
||||
RSSI="$RSSI / "${T##*:}" dBm"
|
||||
fi
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSSI":"'$RSSI'"}'
|
||||
fi
|
||||
#T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $6}')
|
||||
#if [ -n "$T" ]; then
|
||||
# SINR=${T##*:}
|
||||
# T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $15}')
|
||||
# if [ -n "$T" ]; then
|
||||
# SINR="$SINR / "${T##*:}" dB"
|
||||
# fi
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"SINR":"'$SINR'"}'
|
||||
#fi
|
||||
#T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $8}')
|
||||
#if [ -n "$T" ]; then
|
||||
# BW=${T##*:}" MHz"
|
||||
# T=$(echo "$O" | awk -F[,] '/^\$QCAI/{print $17}')
|
||||
# if [ -n "$T" ]; then
|
||||
# BW="$BW / "${T##*:}" MHz"
|
||||
# fi
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"BW":"'$BW'"}'
|
||||
#fi
|
||||
|
||||
T=$(echo "$O" | awk -F[:] '/^\+CCPUTEMP/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,] '/^\+CGNWS/ {print $9}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
COPS="$T"
|
||||
fi
|
@ -0,0 +1,19 @@
|
||||
# ZTE MF821
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+zcellinfo?")
|
||||
BAND=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO:/ {print $4}')
|
||||
case "$MODE_NUM" in
|
||||
7*)
|
||||
case "$BAND" in
|
||||
*"B1") MODE=$(band 1 "LTE ");;
|
||||
*"B3") MODE=$(band 3 "LTE ");;
|
||||
*"B7") MODE=$(band 7 "LTE ");;
|
||||
*"B8") MODE=$(band 8 "LTE ");;
|
||||
*"B20") MODE=$(band 20 "LTE ");;
|
||||
*) MODE="$MODE B${BAND}";;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
MODE="$MODE $BAND"
|
||||
;;
|
||||
esac
|
@ -0,0 +1,62 @@
|
||||
# ZTE MF28D/MF290
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+zrssi?;+zcellinfo?")
|
||||
|
||||
case "$MODE_NUM" in
|
||||
3*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSSI="$T"
|
||||
ADDON="$ADDON"'{"RSSI":"'$T' dBm"}'
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && MODE="$T"
|
||||
;;
|
||||
2*|\
|
||||
4*|\
|
||||
5*|\
|
||||
6*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSCP":"'$T' dBm"}'
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs)
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"ECIO":"'$T' dB"}'
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && MODE="$T"
|
||||
;;
|
||||
7*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRP="$T"
|
||||
ADDON="$ADDON"'{"RSRP":"'$T' dBm"}'
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs)
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRQ="$T"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$T' dB"}'
|
||||
# T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $5}' | xargs)
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
SINR="$T"
|
||||
# ADDON="$ADDON"'{"SINR":"'$T' dB"}'
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCELLINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
PCI="$T"
|
||||
ADDON="$ADDON"'{"PCI":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $5}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
EARFCN="$T"
|
||||
ADDON="$ADDON"'{"EARFCN":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
case "$T" in
|
||||
*"LTE B1") MODE=$(band 1 "LTE ");;
|
||||
*"LTE B3") MODE=$(band 3 "LTE ");;
|
||||
*"LTE B7") MODE=$(band 7 "LTE ");;
|
||||
*"LTE B8") MODE=$(band 8 "LTE ");;
|
||||
*"LTE B20") MODE=$(band 20 "LTE ");;
|
||||
*) MODE="${T}";;
|
||||
esac
|
||||
;;
|
||||
esac
|
114
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21432
Normal file
@ -0,0 +1,114 @@
|
||||
# ZTE MF286
|
||||
# ZTE MF286A
|
||||
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+zrssi;+zcellinfo?;+zcainfo?")
|
||||
|
||||
case "$MODE_NUM" in
|
||||
3*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
RSSI="$T"
|
||||
;;
|
||||
2*|\
|
||||
4*|\
|
||||
5*|\
|
||||
6*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && MODE="$T"
|
||||
;;
|
||||
7*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T_HEX=$(printf "%X" $T)
|
||||
T_DEC=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $4}' | xargs)
|
||||
RSSI="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
RSRP="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs)
|
||||
RSRQ="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $5}' | xargs)
|
||||
SINR="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
MODE="LTE $(band ${T/LTE B/})"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $6}' | xargs)
|
||||
PBAND="$(band $T "") @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $2}' | xargs)
|
||||
[ -n "$T" ] && PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $5}' | xargs)
|
||||
[ -n "$T" ] && EARFCN="$T"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $9}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $11}' | xargs)
|
||||
S1BAND="$(band $T "") @$T1 MHz"
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T})"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && S1PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $10}' | xargs)
|
||||
[ -n "$T" ] && S1EARFCN="$T"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEVV=$(echo $OF | tr -s "\n" | xargs)
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | cut -c 8-)
|
||||
|
||||
MODELA=$(echo $DEVV | awk -F 'Revision: ' '{print $1}'| xargs)
|
||||
MODELB=$(echo $MODELA | awk -F 'Manufacturer: |CORPORATION' '{print $2}'| xargs)
|
||||
|
||||
MODELD=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELDCUT=$(echo $MODELD | cut -c 9-)
|
||||
|
||||
MODEL="$MODELB "$MODELDCUT
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\ICCID:/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=19d2 ProdID=1432' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
#T=$(echo "$O" | awk -F[,:] '/^\+ZDON/ {print $2}' | xargs)
|
||||
#if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
# COPS="$T"
|
||||
#fi
|
182
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21485
Normal file
@ -0,0 +1,182 @@
|
||||
# ZTE MF286D
|
||||
# ZTE MF289F
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+zrssi;+zcellinfo?;+zcainfo?")
|
||||
|
||||
case "$MODE_NUM" in
|
||||
3*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
RSSI="$T"
|
||||
if [ "x${LAC_DEC}" = "x0" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
LAC_DEC=$T
|
||||
LAC_HEX=$(printf "%X" $T)
|
||||
fi
|
||||
fi
|
||||
if [ "x${CID_DEC}" = "x0" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
CID_DEC=$T
|
||||
CID_HEX=$(printf "%X" $T)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
2*|\
|
||||
4*|\
|
||||
5*|\
|
||||
6*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && MODE="$T"
|
||||
if [ "x${LAC_DEC}" = "x0" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
LAC_DEC=$T
|
||||
LAC_HEX=$(printf "%X" $T)
|
||||
fi
|
||||
fi
|
||||
if [ "x${CID_DEC}" = "x0" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
CID_DEC=$T
|
||||
CID_HEX=$(printf "%X" $T)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
7*)
|
||||
if [ "x${CID_DEC}" = "x0" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
CID_DEC=$T
|
||||
CID_HEX=$(printf "%X" $T)
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T_HEX=$(printf "%X" $T)
|
||||
T_DEC=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $4}' | xargs)
|
||||
RSSI="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
RSRP="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs)
|
||||
RSRQ="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $5}' | xargs)
|
||||
SINR="$T"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
MODE="LTE $(band ${T/LTE B/})"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $6}' | xargs)
|
||||
PBAND="$(band $T "") @$T1 MHz"
|
||||
[ "x$MODE" = "xLTE BUnknown" ] && MODE="LTE $(band $T)"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $2}' | xargs)
|
||||
[ -n "$T" ] && PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $5}' | xargs)
|
||||
[ -n "$T" ] && EARFCN="$T"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $9}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $11}' | xargs)
|
||||
S1BAND="$(band $T "") @$T1 MHz"
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T})"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && S1PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $10}' | xargs)
|
||||
[ -n "$T" ] && S1EARFCN="$T"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $14}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $16}' | xargs)
|
||||
S2BAND="$(band $T "") @$T1 MHz"
|
||||
MODE="$MODE / $(band ${T})"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $12}' | xargs)
|
||||
[ -n "$T" ] && S2PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $15}' | xargs)
|
||||
[ -n "$T" ] && S2EARFCN="$T"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $19}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $21}' | xargs)
|
||||
S3BAND="$(band $T "") @$T1 MHz"
|
||||
MODE="$MODE / $(band ${T})"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $17}' | xargs)
|
||||
[ -n "$T" ] && S3PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $20}' | xargs)
|
||||
[ -n "$T" ] && S3EARFCN="$T"
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
# Firmware
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEVV=$(echo $OF | tr -s "\n" | xargs)
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | cut -c 8-)
|
||||
|
||||
# Model
|
||||
MODELA=$(echo $DEVV | awk -F 'Revision: ' '{print $1}'| xargs)
|
||||
MODELB=$(echo $MODELA | awk -F 'Manufacturer: |CORPORATION' '{print $2}'| xargs)
|
||||
|
||||
MODELD=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
|
||||
SUB='MODULE'
|
||||
if [[ "$MODELD" == *"$SUB"* ]]; then
|
||||
MODELDCUT=$(echo $MODELD | awk -F 'CGMM |MODULE' '{print $2}'| xargs)
|
||||
MODEL="$MODELB "$MODELDCUT
|
||||
else
|
||||
MODELDCUT=$(echo $MODELD | cut -c 9-)
|
||||
MODEL="$MODELB "$MODELDCUT
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\ICCID:/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=19d2 ProdID=1485' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
#T=$(echo "$O" | awk -F[,:] '/^\+ZDON/ {print $2}' | xargs)
|
||||
#if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
# COPS="$T"
|
||||
#fi
|
139
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21489
Normal file
@ -0,0 +1,139 @@
|
||||
# ZTE MF286R
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+zrssi;+zcellinfo?;+zcainfo?")
|
||||
|
||||
case "$MODE_NUM" in
|
||||
3*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
RSSI="$T"
|
||||
;;
|
||||
2*|\
|
||||
4*|\
|
||||
5*|\
|
||||
6*|\
|
||||
8*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && MODE="$T"
|
||||
;;
|
||||
|
||||
7*|\
|
||||
9*)
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $4}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
T_HEX=$(printf "%X" $T)
|
||||
T_DEC=$T
|
||||
LAC_DEC=$T_DEC
|
||||
LAC_HEX=$T_HEX
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $4}' | xargs)
|
||||
RSSI="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs)
|
||||
RSRP="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs)
|
||||
RSRQ="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $5}' | xargs)
|
||||
SINR="$T"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
MODE="LTE $(band ${T/LTE B/})"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $6}' | xargs)
|
||||
PBAND="$(band $T "") @$T1 MHz"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
PCI="$T"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $5}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
EARFCN="$T"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x9" ]; then
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $9}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $11}' | xargs)
|
||||
S1BAND="$(band $T "") @$T1 MHz"
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T})"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && S1PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $10}' | xargs)
|
||||
[ -n "$T" ] && S1EARFCN="$T"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
# Firmware
|
||||
FWB=$(sms_tool -d $DEVICE at "AT+GMR")
|
||||
FW=$(echo $FWB | tr -d " \t\n\r" | xargs)
|
||||
|
||||
if [[ "$FW" == *"MF286RA"* && "$CSQ" == *"-"* ]]; then
|
||||
OQ=$(sms_tool -D -d $DEVICE at "AT+CSQ")
|
||||
CSQ=$(echo "$OQ" | awk -F[,\ ] '/^\+CSQ/ {print $2}')
|
||||
|
||||
[ "x$CSQ" = "x" ] && CSQ=-1
|
||||
if [ $CSQ -ge 0 -a $CSQ -le 31 ]; then
|
||||
CSQ_PER=$(($CSQ * 100/31))
|
||||
fi
|
||||
fi
|
||||
|
||||
# Modem
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
|
||||
if [[ "$MODELA" == *"ZTE"* ]]; then
|
||||
MODELACUT=$(echo $MODELA | awk -F'CGMI: ' '{print $2}' | sed 's/"//g' | sed 's/ CORPORATION//g')
|
||||
MODELO=$(echo $MODELACUT | tr -d " \t\n\r" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMM")
|
||||
MODELBCUT=$(echo $MODELB | awk -F'CGMM: ' '{print $2}' | sed 's/"//g')
|
||||
MODELCUT=$(echo $MODELBCUT | tr -d " \t\n\r" | xargs)
|
||||
|
||||
MODEL="$MODELO "$MODELCUT
|
||||
else
|
||||
MODELO=$(echo $MODELA | tr -d " \t\n\r" | cut -d ":" -f2 | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMM")
|
||||
MODELCUT=$(echo $MODELB | tr -d " \t\n\r" | cut -d ":" -f2 | xargs)
|
||||
|
||||
MODEL="$MODELO "$MODELCUT
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
OI=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$OI" | sed 's/AT+GSN//g' | xargs)
|
||||
if [ -z "NR_I" ]; then
|
||||
OIB=$(sms_tool -d $DEVICE at "AT*MRD_IMEI?" | xargs)
|
||||
NR_I=$(echo "$OIB" | awk -F [:] '/^\*MRD_IMEI:/{print $2}' | xargs)
|
||||
NR_IMEI="$NR_I"
|
||||
else
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
OS=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$OS" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
OD=$(sms_tool -d $DEVICE at "AT*ICCID?" | xargs)
|
||||
NR_D=$(echo "$OD" | awk -F [:] '/^\*ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=19d2 ProdID=1489' '{print $2}' | cut -c-1450)
|
||||
if echo "$PVCUT" | grep -q "rndis_host"
|
||||
then
|
||||
PROTO="ncm"
|
||||
fi
|
162
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/1bc71040
Normal file
@ -0,0 +1,162 @@
|
||||
# Telit LN940-CP
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at#servinfo;#cainfo?")
|
||||
|
||||
channeltoband()
|
||||
{
|
||||
if [ $1 -ge 0 ] && [ $1 -le 599 ]; then
|
||||
echo "1"
|
||||
elif [ $1 -ge 1200 ] && [ $1 -le 1949 ]; then
|
||||
echo "3"
|
||||
elif [ $1 -ge 2750 ] && [ $1 -le 3449 ]; then
|
||||
echo "7"
|
||||
elif [ $1 -ge 3450 ] && [ $1 -le 3799 ]; then
|
||||
echo "8"
|
||||
elif [ $1 -ge 6150 ] && [ $1 -le 6449 ]; then
|
||||
echo "20"
|
||||
else
|
||||
echo "?"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$MODE_NUM" in
|
||||
7*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $4}' | xargs)
|
||||
[ -n "$COPS" ] && COPS="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $7}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
ADDON="$ADDON"'{"TAC":"'$T_DEC' ('$T')"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSSI=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSSI":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $10}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
EARFCN=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"EARFCN":"'$T'"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T1=$(channeltoband $T)
|
||||
PBAND="$(band $T1 "")"
|
||||
ADDON="$ADDON"'{"Primary band":"'$(band $T1 "")'"}'
|
||||
MODE=$(band $T1 "LTE ")
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $5}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
PCI=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"PCI":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $7}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSSI=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSSI":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $6}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $8}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRQ=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $9}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SINR=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"SINR":"'$T'"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $15}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T1=$(channeltoband $T)
|
||||
S1BAND=="$(band $T1 "")"
|
||||
ADDON="$ADDON"'{"(S1) band":"'$(band $T1 "")'"}'
|
||||
MODE="${MODE/LTE/LTE_A} / "$(band $T1 "")
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $17}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
S1PCI=$T
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S1) PCI":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $19}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S1) RSSI":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $18}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S1) RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $20}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S1) RSRQ":"'$T' dB"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $21}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S1) SINR":"'$T' dB"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $26}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T1=$(channeltoband $T)
|
||||
S2BAND=="$(band $T1 "")"
|
||||
ADDON="$ADDON"'{"(S2) band":"'$(band $T1 "")'"}'
|
||||
MODE="${MODE} / "$(band $T1 "")
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $28}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
S2PCI="$T"
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S2) PCI":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $30}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S2) RSSI":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $29}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S2) RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $31}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S2) RSRQ":"'$T' dB"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#CAINFO/ {print $32}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"(S2) SINR":"'$T' dB"}'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,')
|
@ -0,0 +1,42 @@
|
||||
# Telit LE910-EUG
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at#servinfo")
|
||||
|
||||
case "$MODE_NUM" in
|
||||
7*)
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $4}' | xargs)
|
||||
[ -n "$COPS" ] && COPS="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $7}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
TAC_HEX=$T
|
||||
TAC_DEC=$T_DEC
|
||||
ADDON="$ADDON"'{"TAC":"'$T_DEC' ('$T')"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSSI="$T"
|
||||
ADDON="$ADDON"'{"RSSI":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $10}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRP="$T"
|
||||
ADDON="$ADDON"'{"RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $6}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
PCI="$(printf "%d" "0x$T")"
|
||||
ADDON="$ADDON"'{"PCI":"'$(printf "%d" "0x$T")'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^#SERVINFO/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
EARFCN="$T"
|
||||
ADDON="$ADDON"'{"EARFCN":"'$T'"}'
|
||||
fi
|
||||
;;
|
||||
esac
|
128
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/1bc71900
Normal file
@ -0,0 +1,128 @@
|
||||
# Telit LN940 (QMI) / Telit LN940 (MBIM) / HP lt4220 (MBIM) / HP lt4220 (QMI)
|
||||
|
||||
O=$(sms_tool -D -d $DEVICE at "AT^CA_INFO?;^RFSTS?;+TEMP")
|
||||
|
||||
TR=$(echo "$O" |grep -A2 RFSTS: | awk 'NR ==2{print $0}')
|
||||
|
||||
if [ "$MODE" = "LTE" ]; then
|
||||
RSRP=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$3}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSRQ=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$5}')
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$16*2-20}')
|
||||
else
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$6}')
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\PCC info: /{print $2}' | sed 's/Band is //g')
|
||||
[ -z "$T" ] && T=$(echo "$O" | awk -F[,] '/^\PCC info: /{print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
PC=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="LTE | $(band $PC)"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC1 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC1=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE/LTE/LTE_A} / "$(band ${SC1} "")
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC2 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC2=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE} / "$(band ${SC2} "")
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A ,')
|
||||
|
||||
# Primary band
|
||||
T1=$(echo "$O" | awk '/PCC/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T1" ]; then
|
||||
T2=$(echo "$O" | awk '/PCC/{print $8}' | sed -e 's/Band_width//g')
|
||||
PBAND="$(band ${T1/B/} "") @$T2 MHz"
|
||||
EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S1)
|
||||
T3=$(echo "$O" | awk '/SCC1/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T3" ]; then
|
||||
T4=$(echo "$O" | awk '/SCC1/{print $8}' | sed -e 's/Band_width//g')
|
||||
S1BAND="$(band ${T3/B/} "") @$T4 MHz"
|
||||
# S1EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S1PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S2)
|
||||
T5=$(echo "$O" | awk '/SCC2/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T5" ]; then
|
||||
T6=$(echo "$O" | awk '/SCC2/{print $8}' | sed -e 's/Band_width//g')
|
||||
S2BAND="$(band ${T5/B/} "") @$T6 MHz"
|
||||
# S2EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S2PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F [:] '/tsens_tz_sensor0:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP=$(echo "$T °C")
|
||||
fi
|
||||
|
||||
# Cell ID & LAC & TAC
|
||||
LAC_HEX=$(printf "%X" $LAC_DEC)
|
||||
if [ -n "$LAC_DEC" ]; then
|
||||
TAC_HEX=$LAC_HEX
|
||||
fi
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1bc7 ProdID=1900' '{print $2}' | cut -c-1220)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Model
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=1bc7 ProdID=1900' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}')
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | awk -F " " '/GSN /{print $2}')
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | awk -F " " '/CIMI /{print $2}')
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)v
|
128
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/1bc71901
Normal file
@ -0,0 +1,128 @@
|
||||
# Telit LN940 (QMI) / Telit LN940 (MBIM) / HP lt4220 (MBIM) / HP lt4220 (QMI)
|
||||
|
||||
O=$(sms_tool -D -d $DEVICE at "AT^CA_INFO?;^RFSTS?;+TEMP")
|
||||
|
||||
TR=$(echo "$O" |grep -A2 RFSTS: | awk 'NR ==2{print $0}')
|
||||
|
||||
if [ "$MODE" = "LTE" ]; then
|
||||
RSRP=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$3}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSRQ=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$5}')
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$16*2-20}')
|
||||
else
|
||||
SINR=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$4}')
|
||||
RSSI=$(echo "$TR" | awk -F [,] '{printf "%.0f\n",$6}')
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\PCC info: /{print $2}' | sed 's/Band is //g')
|
||||
[ -z "$T" ] && T=$(echo "$O" | awk -F[,] '/^\PCC info: /{print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
PC=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="LTE | $(band $PC)"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC1 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC1=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE/LTE/LTE_A} / "$(band ${SC1} "")
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\SCC2 info: /{print $2}' | sed 's/Band is //g')
|
||||
if [ -n "$T" ]; then
|
||||
SC2=$(echo $T | tr -d 'LTE_B')
|
||||
MODE="${MODE} / "$(band ${SC2} "")
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A ,')
|
||||
|
||||
# Primary band
|
||||
T1=$(echo "$O" | awk '/PCC/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T1" ]; then
|
||||
T2=$(echo "$O" | awk '/PCC/{print $8}' | sed -e 's/Band_width//g')
|
||||
PBAND="$(band ${T1/B/} "") @$T2 MHz"
|
||||
EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S1)
|
||||
T3=$(echo "$O" | awk '/SCC1/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T3" ]; then
|
||||
T4=$(echo "$O" | awk '/SCC1/{print $8}' | sed -e 's/Band_width//g')
|
||||
S1BAND="$(band ${T3/B/} "") @$T4 MHz"
|
||||
# S1EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S1PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S2)
|
||||
T5=$(echo "$O" | awk '/SCC2/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T5" ]; then
|
||||
T6=$(echo "$O" | awk '/SCC2/{print $8}' | sed -e 's/Band_width//g')
|
||||
S2BAND="$(band ${T5/B/} "") @$T6 MHz"
|
||||
# S2EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S2PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | awk -F [:] '/tsens_tz_sensor0:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP=$(echo "$T °C")
|
||||
fi
|
||||
|
||||
# Cell ID & LAC & TAC
|
||||
LAC_HEX=$(printf "%X" $LAC_DEC)
|
||||
if [ -n "$LAC_DEC" ]; then
|
||||
TAC_HEX=$LAC_HEX
|
||||
fi
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1bc7 ProdID=1901' '{print $2}' | cut -c-1220)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Model
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=1bc7 ProdID=1901' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}')
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | awk -F " " '/GSN /{print $2}')
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | awk -F " " '/CIMI /{print $2}')
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)
|
@ -0,0 +1,93 @@
|
||||
# SIMCOM SIM8200EA-M2
|
||||
|
||||
OT=$(sms_tool -d $DEVICE at "AT+CPMUTEMP")
|
||||
|
||||
T=$(echo "$OT" | awk -F[,:] '/^\+CPMUTEMP: / {print $2}' | xargs)
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "AT+CPSI?")
|
||||
|
||||
case $MODE_NUM in
|
||||
7)
|
||||
MODE="LTE |"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
TAC_DEC=$(printf "%d" "$T")
|
||||
TAC_HEX="${T/0x/}"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $7}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $8}')
|
||||
if [ -n "$T" ]; then
|
||||
PBAND="$(band ${T/EUTRAN-BAND/})"
|
||||
MODE="$MODE $(band ${T/EUTRAN-BAND/})"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $9}')
|
||||
[ -n "$T" ] && EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $10}')
|
||||
[ -n "$T" ] && DLBW="DL: @$T MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $11}')
|
||||
[ -n "$T" ] && ULBW="UL: @$T MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $12/10}')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $13/10}')
|
||||
[ -n "$T" ] && RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $14/10}')
|
||||
[ -n "$T" ] && RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CPSI: LTE/ {print $15}')
|
||||
[ -n "$T" ] && SINR=$T
|
||||
;;
|
||||
11) MODE="5G-SA";;
|
||||
13) MODE="5G-NSA";;
|
||||
esac
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,'| sed 's,LTE B,LTE | B,')
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "AT+CGMR")
|
||||
FWA=$(echo "$OF" | awk -F [:] '/^\+CGMR: /{print $2}' | xargs)
|
||||
if [ -n "$FWA" ]; then
|
||||
FW="$FWA"
|
||||
fi
|
||||
|
||||
OL=$(sms_tool -d $DEVICE at "AT+CGMM")
|
||||
MODELB=$(echo "$OL" | sed s/"AT+CGMM"// | tr -s "\n" | xargs)
|
||||
if [ -n "$MODELB" ]; then
|
||||
MODEL="$(echo $MODELB | sed 's,_, ,')"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
OM=$(sms_tool -d $DEVICE at "AT+CGSN")
|
||||
NR_I=$(echo "$OM" | sed s/"AT+CGSN"// | xargs)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
OC=$(sms_tool -d $DEVICE at "AT+CIMI")
|
||||
NR_C=$(echo "$OC" | sed s/"AT+CIMI"// | tr -s "\n" | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
OI=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$OI" | awk -F [:] '/^\+ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1e0e ProdID=9001' '{print $2}' | cut -c-1290)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
157
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/1e2d00b3
Normal file
@ -0,0 +1,157 @@
|
||||
# Thales MV31-w (MBIM) /
|
||||
|
||||
if [ "$REG" = "0" ] || [ "x$MODE_NUM" = "x11" ]; then
|
||||
O=$(sms_tool -d $DEVICE at "at+c5greg=2;+c5greg?")
|
||||
|
||||
# C5GREG
|
||||
eval $(echo "$O" | awk -F[,] '/^\+C5GREG/ {gsub(/[[:space:]"]+/,"");printf "T=\"%d\";TAC_HEX=\"%X\";CID_HEX=\"%s\";TAC_DEC=\"%d\";MODE_NUM=\"%d\"", $2, "0x"$3, $4, "0x"$3, $5}')
|
||||
case "$T" in
|
||||
0*) REG="0";;
|
||||
1*) REG="1";;
|
||||
2*) REG="2";;
|
||||
3*) REG="3";;
|
||||
5*) REG="5";;
|
||||
*) REG="";;
|
||||
esac
|
||||
[ "x$REG" = "x1" ] || [ "x$REG" = "x5" ] && REGOK=1
|
||||
|
||||
[ "$TAC_DEC" != "0" ]
|
||||
[ -n "$CID_HEX" ] && CID_DEC=$(printf "%d" "0x${CID_HEX}")
|
||||
fi
|
||||
|
||||
O=$(sms_tool -D -d $DEVICE at "AT^CA_INFO?;^debug?;^temp?")
|
||||
|
||||
MODE=$(echo "$O" | grep RAT: | cut -d: -f2 | tr -d '\n\r')
|
||||
|
||||
RSRP=$(echo "$O" | grep -o [rea]_rsrp:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
RSRQ=$(echo "$O" | grep -o rsrq:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
RSSI=$(echo "$O" | grep -o rssi:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
SINR=$(echo "$O" | grep -o snr:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
PCI=$(echo "$O" | grep -o pci:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
|
||||
if echo "$MODE" | grep -qi LTE; then
|
||||
PBAND=$(echo "$O" | grep -o _band:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
PBAND_W=$(echo "$O" | grep -o _band_width:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
PBAND="$(band $PBAND "") @${PBAND_W}MHz"
|
||||
fi
|
||||
if [ "$TAC_DEC" = "0" ] || [ -z "$TAC_DEC" ]; then
|
||||
TAC_DEC=$(echo "$O" | grep -o tac:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
TAC_HEX=$(printf "%X" $TAC_DEC)
|
||||
CID_DEC=$(echo "$O" | grep cell_id:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
if
|
||||
LAC_DEC=$(echo "$O" | grep -o lac.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
LAC_HEX=$(printf "%X" $((LAC_DEC + 0)))
|
||||
|
||||
if test -z "$CSQ_PER"; then
|
||||
|
||||
if test "$RSRP" -ge "-80"; then
|
||||
CSQ_PER=80
|
||||
elif test "$RSRP" -ge "-100"; then
|
||||
CSQ_PER=50
|
||||
else
|
||||
CSQ_PER=25
|
||||
fi
|
||||
|
||||
if [ -n "$RSSI" ]; then
|
||||
_RSSI=$RSSI
|
||||
[ $_RSSI -lt -113 ] && _RSSI="-113"
|
||||
[ $_RSSI -gt -51 ] && _RSSI="-51"
|
||||
[ -z "$CSQ_PER" ] && CSQ_PER=$(((_RSSI + 113) * 100 / 62 ))
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Primary band
|
||||
T1=$(echo "$O" | awk '/PCC/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T1" ]; then
|
||||
T2=$(echo "$O" | awk '/PCC/{print $8}' | sed -e 's/Band_width//g')
|
||||
PBAND="$(band ${T1/B/} "") @$T2 MHz"
|
||||
EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
test -n "$PCI" || PCI=$(echo "$O" | grep nr_pci: | cut -d: -f2 | tr -d '\n\r')
|
||||
|
||||
# CA band (S1)
|
||||
T3=$(echo "$O" | awk '/SCC1/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T3" ]; then
|
||||
T4=$(echo "$O" | awk '/SCC1/{print $8}' | sed -e 's/Band_width//g')
|
||||
S1BAND="$(band ${T3/B/} "") @$T4 MHz"
|
||||
# S1EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S1PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S2)
|
||||
T5=$(echo "$O" | awk '/SCC2/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T5" ]; then
|
||||
T6=$(echo "$O" | awk '/SCC2/{print $8}' | sed -e 's/Band_width//g')
|
||||
S2BAND="$(band ${T5/B/} "") @$T6 MHz"
|
||||
# S2EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S2PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | grep TSENS: | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
if [ -n "$T" ]; then
|
||||
TEMP=$(echo "$T °C")
|
||||
fi
|
||||
|
||||
# Slot SIM
|
||||
O=$(sms_tool -d $DEVICE at "AT+CPIN?")
|
||||
T=$(echo "$O" | awk -F [:] '/^\+CPIN/{print $2}' | xargs)
|
||||
if [ "$T" = "READY" ]; then
|
||||
SSIM=1
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1e2d ProdID=00b3' '{print $2}' | cut -c-1220)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Model
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=1e2d ProdID=00b3' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}')
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | awk -F " " '/GSN /{print $2}')
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | awk -F " " '/CIMI /{print $2}')
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)v
|
157
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/1e2d00b7
Normal file
@ -0,0 +1,157 @@
|
||||
# Thales MV31-w (QMI) /
|
||||
|
||||
if [ "$REG" = "0" ] || [ "x$MODE_NUM" = "x11" ]; then
|
||||
O=$(sms_tool -d $DEVICE at "at+c5greg=2;+c5greg?")
|
||||
|
||||
# C5GREG
|
||||
eval $(echo "$O" | awk -F[,] '/^\+C5GREG/ {gsub(/[[:space:]"]+/,"");printf "T=\"%d\";TAC_HEX=\"%X\";CID_HEX=\"%s\";TAC_DEC=\"%d\";MODE_NUM=\"%d\"", $2, "0x"$3, $4, "0x"$3, $5}')
|
||||
case "$T" in
|
||||
0*) REG="0";;
|
||||
1*) REG="1";;
|
||||
2*) REG="2";;
|
||||
3*) REG="3";;
|
||||
5*) REG="5";;
|
||||
*) REG="";;
|
||||
esac
|
||||
[ "x$REG" = "x1" ] || [ "x$REG" = "x5" ] && REGOK=1
|
||||
|
||||
[ "$TAC_DEC" != "0" ]
|
||||
[ -n "$CID_HEX" ] && CID_DEC=$(printf "%d" "0x${CID_HEX}")
|
||||
fi
|
||||
|
||||
O=$(sms_tool -D -d $DEVICE at "AT^CA_INFO?;^debug?;^temp?")
|
||||
|
||||
MODE=$(echo "$O" | grep RAT: | cut -d: -f2 | tr -d '\n\r')
|
||||
|
||||
RSRP=$(echo "$O" | grep -o [rea]_rsrp:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
RSRQ=$(echo "$O" | grep -o rsrq:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
RSSI=$(echo "$O" | grep -o rssi:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
SINR=$(echo "$O" | grep -o snr:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
PCI=$(echo "$O" | grep -o pci:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
|
||||
if echo "$MODE" | grep -qi LTE; then
|
||||
PBAND=$(echo "$O" | grep -o _band:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
PBAND_W=$(echo "$O" | grep -o _band_width:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
PBAND="$(band $PBAND "") @${PBAND_W}MHz"
|
||||
fi
|
||||
if [ "$TAC_DEC" = "0" ] || [ -z "$TAC_DEC" ]; then
|
||||
TAC_DEC=$(echo "$O" | grep -o tac:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
TAC_HEX=$(printf "%X" $TAC_DEC)
|
||||
CID_DEC=$(echo "$O" | grep cell_id:.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
fi
|
||||
LAC_DEC=$(echo "$O" | grep -o lac.* | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
LAC_HEX=$(printf "%X" $((LAC_DEC + 0)))
|
||||
|
||||
if test -z "$CSQ_PER"; then
|
||||
|
||||
if test "$RSRP" -ge "-80"; then
|
||||
CSQ_PER=80
|
||||
elif test "$RSRP" -ge "-100"; then
|
||||
CSQ_PER=50
|
||||
else
|
||||
CSQ_PER=25
|
||||
fi
|
||||
|
||||
if [ -n "$RSSI" ]; then
|
||||
_RSSI=$RSSI
|
||||
[ $_RSSI -lt -113 ] && _RSSI="-113"
|
||||
[ $_RSSI -gt -51 ] && _RSSI="-51"
|
||||
[ -z "$CSQ_PER" ] && CSQ_PER=$(((_RSSI + 113) * 100 / 62 ))
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Primary band
|
||||
T1=$(echo "$O" | awk '/PCC/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T1" ]; then
|
||||
T2=$(echo "$O" | awk '/PCC/{print $8}' | sed -e 's/Band_width//g')
|
||||
PBAND="$(band ${T1/B/} "") @$T2 MHz"
|
||||
EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
test -n "$PCI" || PCI=$(echo "$O" | grep nr_pci: | cut -d: -f2 | tr -d '\n\r')
|
||||
|
||||
# CA band (S1)
|
||||
T3=$(echo "$O" | awk '/SCC1/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T3" ]; then
|
||||
T4=$(echo "$O" | awk '/SCC1/{print $8}' | sed -e 's/Band_width//g')
|
||||
S1BAND="$(band ${T3/B/} "") @$T4 MHz"
|
||||
# S1EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S1PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# CA band (S2)
|
||||
T5=$(echo "$O" | awk '/SCC2/{print $5}' | sed -e 's/LTE_//g' -e 's/.$//')
|
||||
if [ -n "$T5" ]; then
|
||||
T6=$(echo "$O" | awk '/SCC2/{print $8}' | sed -e 's/Band_width//g')
|
||||
S2BAND="$(band ${T5/B/} "") @$T6 MHz"
|
||||
# S2EARFCN=$(echo "$TR" |awk -F [,] '{print $2}')
|
||||
# S2PCI=$(echo "$TR" |awk -F [,] '{print $11}')
|
||||
fi
|
||||
|
||||
# Temperature
|
||||
T=$(echo "$O" | grep TSENS: | awk -F [:] '{printf "%.0f\n",$2}')
|
||||
if [ -n "$T" ]; then
|
||||
TEMP=$(echo "$T °C")
|
||||
fi
|
||||
|
||||
# Slot SIM
|
||||
O=$(sms_tool -d $DEVICE at "AT+CPIN?")
|
||||
T=$(echo "$O" | awk -F [:] '/^\+CPIN/{print $2}' | xargs)
|
||||
if [ "$T" = "READY" ]; then
|
||||
SSIM=1
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=1e2d ProdID=00b7' '{print $2}' | cut -c-1220)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Model
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=1e2d ProdID=00b7' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}')
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | awk -F " " '/GSN /{print $2}')
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | awk -F " " '/CIMI /{print $2}')
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)v
|
@ -0,0 +1,66 @@
|
||||
# BroadMobi BM806U
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "AT+BMTCELLINFO")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^TAC:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T_HEX=$(printf "%X" $T)
|
||||
ADDON="$ADDON"'{"TAC":"'$T' ('$T_HEX')"}'
|
||||
fi
|
||||
|
||||
ADDON=""
|
||||
T=$(echo "$O" | awk -F[,:] '/^RSSI:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSSI="$T"
|
||||
ADDON="$ADDON"'{"RSSI":"-'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^RSRP:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRP="$T"
|
||||
ADDON="$ADDON"'{"RSRP":"'$T' dBm"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^RSRQ:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRQ="$T"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$T' dB"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^SINR:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
SINR="$T"
|
||||
ADDON="$ADDON"'{"SINR":"'$T' dB"}'
|
||||
fi
|
||||
|
||||
if [ "x$MODE" = "xLTE" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^ACTIVE BAND:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
case "$T" in
|
||||
*"1") MODE=$(band 1 "LTE ");;
|
||||
*"3") MODE=$(band 3 "LTE ");;
|
||||
*"7") MODE=$(band 7 "LTE ");;
|
||||
*"8") MODE=$(band 8 "LTE ");;
|
||||
*"20") MODE=$(band 20 "LTE ");;
|
||||
*) MODE="LTE B${T}";;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^PCI:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"PCI":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^EARFCN_DL:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"EARFCN DL":"'$T'"}'
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^EARFCN_UL:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ "x$T" != "x0" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"EARFCN UL":"'$T'"}'
|
||||
fi
|
120
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0125
Normal file
@ -0,0 +1,120 @@
|
||||
# Quectel EC20-E
|
||||
# Quectel EC25
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp;+qnwinfo;+qeng=\"servingcell\";+qspn")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {t=$2*1;if($3*1>t)t=$3*1;if($4*1>t)t=$4*1;printf "%d", t}')
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
TEMP="$T °C"
|
||||
ADDON="$ADDON"'{"Temperatura":"'$T' °C"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO:/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
case "$T" in
|
||||
*"LTE BAND 1") MODE=$(band 1 "LTE ");;
|
||||
*"LTE BAND 3") MODE=$(band 3 "LTE ");;
|
||||
*"LTE BAND 7") MODE=$(band 5 "LTE ");;
|
||||
*"LTE BAND 7") MODE=$(band 7 "LTE ");;
|
||||
*"LTE BAND 8") MODE=$(band 8 "LTE ");;
|
||||
*"LTE BAND 20") MODE=$(band 20 "LTE ");;
|
||||
*"LTE BAND 28") MODE=$(band 28 "LTE ");;
|
||||
*"LTE BAND 32") MODE=$(band 32 "LTE ");;
|
||||
*"LTE BAND 38") MODE=$(band 38 "LTE ");;
|
||||
*"LTE BAND 40") MODE=$(band 40 "LTE ");;
|
||||
*"LTE BAND 41") MODE=$(band 41 "LTE ");;
|
||||
*) MODE="$T";;
|
||||
esac
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ] || [ "x$T" = "x4G" ]; then
|
||||
# CELLID=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $8}' | xargs)
|
||||
# PCID=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}' | xargs)
|
||||
# EARFCN=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $10}' | xargs)
|
||||
# FREQ_BAND_IND=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $11}' | xargs)
|
||||
ULBW=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}' | xargs)
|
||||
DLBW=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}' | xargs)
|
||||
# TAC=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}' | xargs)
|
||||
RSRP=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}' | xargs)
|
||||
RSRQ=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}' | xargs)
|
||||
RSSI=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $17}' | xargs)
|
||||
SINR=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | xargs | awk '{printf "%.1f\n", $1*0.2-20}')
|
||||
# SRXLEV=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $19}' | xargs)
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"CELLID":"'$CELLID'"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"PCID":"'$PCID'"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"EARFCN":"'$EARFCN'"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"FREQ_BAND_IND":"'$FREQ_BAND_IND'"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"UL_BANDWIDTH":"'$UL_BANDWIDTH'"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"DL_BANDWIDTH":"'$DL_BANDWIDTH'"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"TAC":"'$TAC'"}'
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRP":"'$RSRP' dBm"}'
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSRQ":"'$RSRQ' dB"}'
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"RSSI":"'$RSSI' dBm"}'
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"SINR":"'$SINR' dB"}'
|
||||
# [ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
# ADDON="$ADDON"'{"SRXLEV":"'$SRXLEV'"}'
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEVV=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEVV | awk -F 'Revision:' '{print $2}'| xargs)
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $1}'| xargs)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $2}'| xargs)
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=0125' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
149
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0306
Normal file
@ -0,0 +1,149 @@
|
||||
# Quectel EP06
|
||||
# Quectel EG06
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {t=$2*1;if($3*1>t)t=$3*1;if($4*1>t)t=$4*1;printf "%d", t}')
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qnwinfo;+qeng=\"servingcell\";+qspn")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO/ {print $2"/"$4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
B=$(echo $T | sed 's/.*LTE BAND \(.*\)/\1/')
|
||||
MODE="LTE $(band ${B})"
|
||||
MAINCUT="$(band ${B})"
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ] || [ "x$T" = "x4G" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0) T1="1.4";;
|
||||
1) T1="3";;
|
||||
2) T1="5";;
|
||||
3) T1="10";;
|
||||
4) T1="15";;
|
||||
5) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0) T1="1.4";;
|
||||
1) T1="3";;
|
||||
2) T1="5";;
|
||||
3) T1="10";;
|
||||
4) T1="15";;
|
||||
5) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
DLBW="DL: @$T1 MHz"
|
||||
PBAND="$MAINCUT $DLBW $ULBW"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}')
|
||||
PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $10}')
|
||||
EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $17}')
|
||||
RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}')
|
||||
RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}')
|
||||
RSRQ=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.1f\n", $1*0.2-20}')
|
||||
SINR=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCAINFO")
|
||||
|
||||
T=$(echo "$O" | awk -F[,] '/^\+QCAINFO: "scc"/{print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
B=$(echo $T | sed 's/.*LTE BAND \(.*\)/\1/')
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $4}')
|
||||
case $T in
|
||||
6) T1="1.4";;
|
||||
15) T1="3";;
|
||||
25) T1="5";;
|
||||
50) T1="10";;
|
||||
75) T1="15";;
|
||||
100) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${B})"
|
||||
S1BAND="$(band ${B}) @$T1 MHz"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $7}')
|
||||
S1PCI="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $3}')
|
||||
S1EARFCN="$T"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $10}')
|
||||
RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $8}')
|
||||
RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $9}')
|
||||
RSRQ=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "scc"/ {print $11}' | awk '{printf "%.1f\n", $1*0.2-20}')
|
||||
SINR=$T
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed "s/LTE_A/LTE-A | /g")
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEVV=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEVV | awk -F 'Revision:' '{print $2}'| xargs)
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $1}'| xargs)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $2}'| xargs)
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=0306' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
242
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0512
Normal file
@ -0,0 +1,242 @@
|
||||
# Quectel EG18-EA
|
||||
# Quectel EM12-G
|
||||
# Quectel EM160R-GL
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {print $3}' | sort -r | head -n1 | xargs)
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qeng=\"servingcell\";+qnwinfo;+qspn;+qcainfo")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
echo "$O" | grep -q -i "+QCAINFO.*SCC" && MODE="LTE_A"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
MODE="$MODE $(band ${B})"
|
||||
|
||||
T1=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{gsub(" ", "-");print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
for T in $T1; do
|
||||
B=$(echo $T | sed 's/"LTE-BAND-\(.*\)"/\1/')
|
||||
MODE="$MODE / $(band ${B})"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ]; then
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
TAC_DEC=$(printf "%d" "0x$T")
|
||||
TAC_HEX=$T
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $16}' | awk '{printf "%.1f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && DLBW="DL: @$T1 MHz"
|
||||
fi
|
||||
fi
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
T3=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $4}')
|
||||
case $T3 in
|
||||
6) T4="1.4";;
|
||||
15) T4="3";;
|
||||
25) T4="5";;
|
||||
50) T4="10";;
|
||||
75) T4="15";;
|
||||
100) T4="20";;
|
||||
*) T4="";;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
PBAND="$T2"
|
||||
else
|
||||
PBAND="$T2 @$T4 MHz"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $3}')
|
||||
[ -n "$T" ] && EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $7}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $10}')
|
||||
[ -n "$T" ] && RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $8}')
|
||||
[ -n "$T" ] && RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $9}')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
|
||||
IDX=1
|
||||
LINES=$(echo "$O" | grep -E "^\+QCAINFO: \"(scc|SCC)\"")
|
||||
for LINE in $LINES; do
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $5}')
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
T3=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $4}')
|
||||
case $T3 in
|
||||
6) T4="1.4";;
|
||||
15) T4="3";;
|
||||
25) T4="5";;
|
||||
50) T4="10";;
|
||||
75) T4="15";;
|
||||
100) T4="20";;
|
||||
*) T4="";;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2";;
|
||||
2) S2BAND="$T2";;
|
||||
3) S3BAND="$T2";;
|
||||
4) S4BAND="$T2";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2 @$T4 MHz";;
|
||||
2) S2BAND="$T2 @$T4 MHz";;
|
||||
3) S3BAND="$T2 @$T4 MHz";;
|
||||
4) S4BAND="$T2 @$T4 MHz";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1EARFCN="$T";;
|
||||
2) S2EARFCN="$T";;
|
||||
3) S3EARFCN="$T";;
|
||||
4) S4EARFCN="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$T";;
|
||||
2) S2PCI="$T";;
|
||||
3) S3PCI="$T";;
|
||||
4) S4PCI="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
# T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
# addon $((POS + 4)) "(S${IDX}) EARFCN" "$T"
|
||||
# T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
# addon $((POS + 3)) "(S${IDX}) PCI" "$T"
|
||||
# T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $10}')
|
||||
# addon $((POS + 5)) "(S${IDX}) RSSI" "$T dBm"
|
||||
# T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# addon $((POS + 6)) "(S${IDX}) RSRP" "$T dBm"
|
||||
# T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $9}')
|
||||
# addon $((POS + 7)) "(S${IDX}) RSRQ" "$T dB"
|
||||
|
||||
IDX=$((IDX + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,'| sed 's,LTE B,LTE | B,')
|
||||
|
||||
# Modem
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEVV=$(echo $OF | tr -s "\n" | xargs)
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | cut -c 8-)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
MODELACUT=$(echo $MODELA | cut -c 9-)
|
||||
MODELBCUT=$(echo $MODELB | cut -c 9-)
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODEL=$(echo $DEVV | awk -F 'ati|Revision:' '{print $2}'| xargs)
|
||||
fi
|
||||
|
||||
# Slot SIM
|
||||
O=$(sms_tool -d $DEVICE at "AT+QUIMSLOT?")
|
||||
T=$(echo "$O" | awk -F [:] '/^\+QUIMSLOT/{print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SSIM="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=0512' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
257
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0620
Normal file
@ -0,0 +1,257 @@
|
||||
# Quectel EM160R-GL
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {print $3}' | sort -r | head -n1 | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qeng=\"servingcell\";+qnwinfo;+qspn;+qcainfo")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
echo "$O" | grep -q -i "+QCAINFO.*SCC" && MODE="LTE-A |"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
MODE="$MODE $(band ${B})"
|
||||
|
||||
T1=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{gsub(" ", "-");print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
for T in $T1; do
|
||||
B=$(echo $T | sed 's/"LTE-BAND-\(.*\)"/\1/')
|
||||
MODE="$MODE / $(band ${B})"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$T
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $17}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSSI=$T
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$T
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
RSRQ=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
PCI=$T
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $10}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
EARFCN=$T
|
||||
fi
|
||||
|
||||
QO=$(sms_tool -d $DEVICE at "at+qnwinfo;")
|
||||
PBAND=$(echo "$QO" | awk -F[,:] '/^\+QNWINFO:/ {print $4}' | xargs)
|
||||
MAINCUT=$(echo $PBAND | sed 's/LTE BAND //g')
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
DLBW="DL: @$T1 MHz"
|
||||
|
||||
PBAND="$(band $MAINCUT "") $DLBW $ULBW"
|
||||
if [ "x$MODE" = "xLTE" ]; then
|
||||
MODE="LTE | $(band $MAINCUT "")"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
T3=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $4}')
|
||||
case $T3 in
|
||||
6) T4="1.4";;
|
||||
15) T4="3";;
|
||||
25) T4="5";;
|
||||
50) T4="10";;
|
||||
75) T4="15";;
|
||||
100) T4="20";;
|
||||
*) T4="?";;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
PBAND="$T2"
|
||||
else
|
||||
PBAND="$T2 @$T4 MHz"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $3}')
|
||||
EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $7}')
|
||||
PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $10}')
|
||||
RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $8}')
|
||||
RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $9}')
|
||||
RSRQ=$T
|
||||
|
||||
IDX=1
|
||||
LINES=$(echo "$O" | grep -E "^\+QCAINFO: \"(scc|SCC)\"")
|
||||
for LINE in $LINES; do
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $5}')
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
T3=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $4}')
|
||||
case $T3 in
|
||||
6) T4="1.4";;
|
||||
15) T4="3";;
|
||||
25) T4="5";;
|
||||
50) T4="10";;
|
||||
75) T4="15";;
|
||||
100) T4="20";;
|
||||
*) T4="?";;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2";;
|
||||
2) S2BAND="$T2";;
|
||||
3) S3BAND="$T2";;
|
||||
4) S4BAND="$T2";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2 @$T4 MHz";;
|
||||
2) S2BAND="$T2 @$T4 MHz";;
|
||||
3) S3BAND="$T2 @$T4 MHz";;
|
||||
4) S4BAND="$T2 @$T4 MHz";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1EARFCN="$T";;
|
||||
2) S2EARFCN="$T";;
|
||||
3) S3EARFCN="$T";;
|
||||
4) S4EARFCN="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$T";;
|
||||
2) S2PCI="$T";;
|
||||
3) S3PCI="$T";;
|
||||
4) S4PCI="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
IDX=$((IDX + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,'| sed 's,LTE B,LTE | B,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+GMR "//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM "//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI "//)
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# Slot SIM
|
||||
O=$(sms_tool -d $DEVICE at "AT+QUIMSLOT?")
|
||||
T=$(echo "$O" | awk -F [:] '/^\+QUIMSLOT/{print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SSIM="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | cut -c 8-)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | cut -c 9-)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=0620' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
509
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0800
Normal file
@ -0,0 +1,509 @@
|
||||
# Quectel RG502Q-EA
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {print $3}' | sort -r | head -n1 | xargs)
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
if [ "$REG" = "0" ] || [ "x$MODE_NUM" = "x11" ]; then
|
||||
O=$(sms_tool -d $DEVICE at "at+c5greg=2;+c5greg?")
|
||||
|
||||
# C5GREG
|
||||
eval $(echo "$O" | awk -F[,] '/^\+C5GREG/ {gsub(/[[:space:]"]+/,"");printf "T=\"%d\";TAC_HEX=\"%X\";CID_HEX=\"%s\";TAC_DEC=\"%d\";MODE_NUM=\"%d\"", $2, "0x"$3, $4, "0x"$3, $5}')
|
||||
case "$T" in
|
||||
0*) REG="0";;
|
||||
1*) REG="1";;
|
||||
2*) REG="2";;
|
||||
3*) REG="3";;
|
||||
5*) REG="5";;
|
||||
*) REG="";;
|
||||
esac
|
||||
[ "x$REG" = "x1" ] || [ "x$REG" = "x5" ] && REGOK=1
|
||||
|
||||
[ "$TAC_DEC" != "0" ]
|
||||
[ -n "$CID_HEX" ] && CID_DEC=$(printf "%d" "0x${CID_HEX}")
|
||||
fi
|
||||
|
||||
if [ "$REGOK" = "1" ] || :; then
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qeng=\"servingcell\";+qnwinfo;+qspn;+qcainfo")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
case "$MODE_NUM" in
|
||||
7*)
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*SCC"; then
|
||||
MODE="LTE-A |"
|
||||
fi
|
||||
;;
|
||||
11*)
|
||||
MODE="5G-SA |"
|
||||
;;
|
||||
13*)
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*NR5G"; then
|
||||
MODE="5G-NSA |"
|
||||
else
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*PCC.*LTE"; then
|
||||
MODE="LTE |"
|
||||
|
||||
OTS=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$OTS
|
||||
|
||||
TDX=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
TAC_DEC=$(printf "%d" "0x$TDX")
|
||||
TAC_HEX=$TDX
|
||||
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*SCC"; then
|
||||
MODE="LTE-A |"
|
||||
|
||||
OTS=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$OTS
|
||||
|
||||
TDX=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
TAC_DEC=$(printf "%d" "0x$TDX")
|
||||
TAC_HEX=$TDX
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"LTE BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
MODE="$MODE $(band ${B})"
|
||||
;;
|
||||
*"NR5G BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G BAND \(.*\)"/\1/')
|
||||
MODE="$MODE $(band5g ${B})"
|
||||
;;
|
||||
esac
|
||||
|
||||
T1=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{gsub(" ", "-");print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
for T in $T1; do
|
||||
case $T in
|
||||
*"LTE-BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE-BAND-\(.*\)"/\1/')
|
||||
MODE="$MODE / $(band ${B})"
|
||||
;;
|
||||
*"NR5G-BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G-BAND-\(.*\)"/\1/')
|
||||
MODE="$MODE / $(band5g ${B})"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
TAC_DEC=$(printf "%d" "0x$T")
|
||||
TAC_HEX=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.1f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && DLBW="DL: @$T1 MHz"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x11" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xNR5G-SA" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $8}')
|
||||
if [ -n "$T" ]; then
|
||||
CID_HEX=$T
|
||||
CID_DEC=$(printf "%d" "0x${CID_HEX}")
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0) BW="5";;
|
||||
1) BW="10";;
|
||||
2) BW="15";;
|
||||
3) BW="20";;
|
||||
4) BW="25";;
|
||||
5) BW="30";;
|
||||
6) BW="40";;
|
||||
7) BW="50";;
|
||||
8) BW="60";;
|
||||
9) BW="70";;
|
||||
10) BW="80";;
|
||||
11) BW="90";;
|
||||
12) BW="100";;
|
||||
13) BW="200";;
|
||||
14) BW="400";;
|
||||
*) BW="";;
|
||||
esac
|
||||
[ -n "$BW" ] && DBW="@$BW MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$T
|
||||
if [ -n "$BW" ]; then
|
||||
N=$((BW * 5))
|
||||
RSSI=$(echo "$T $N" | awk '{printf "%d\n", $1 + 10*log(12*$2)/log(10)}')
|
||||
if [ -n "$RSSI" ]; then
|
||||
_RSSI=$RSSI
|
||||
[ $_RSSI -lt -113 ] && _RSSI="-113"
|
||||
[ $_RSSI -gt -51 ] && _RSSI="-51"
|
||||
[ -z "$CSQ_PER" ] && CSQ_PER=$(((_RSSI + 113) * 100 / 62 ))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}')
|
||||
[ -n "$T" ] && SINR=$T
|
||||
fi
|
||||
fi
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
if [ "x$MODE_NUM" = "x13" ]; then
|
||||
LINES=$(echo "$O" | grep "+QENG")
|
||||
for LINE in $LINES; do
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/{print $2}' | xargs)
|
||||
if [ "x$T" = "xLTE" ]; then
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
TAC_DEC=$(printf "%d" "0x$T")
|
||||
TAC_HEX=$T
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $16}' | awk '{printf "%.1f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$T
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $10}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $11}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && DLBW="DL: @$T1 MHz"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"LTE BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
;;
|
||||
*"NR5G BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G BAND \(.*\)"/\1/')
|
||||
T2=$(band5g ${B})
|
||||
;;
|
||||
esac
|
||||
T3=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $4}')
|
||||
case $T3 in
|
||||
6*) T4="1.4";;
|
||||
15*) T4="3";;
|
||||
25*) T4="5";;
|
||||
50*) T4="10";;
|
||||
75*) T4="15";;
|
||||
100*) T4="20";;
|
||||
*) T4="";;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
PBAND="$T2"
|
||||
if [ -n "$DBW" ]; then
|
||||
PBAND="$T2 $DBW"
|
||||
fi
|
||||
else
|
||||
PBAND="$T2 @$T4 MHz"
|
||||
fi
|
||||
if [ "x$MODE_NUM" = "x11" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $3}')
|
||||
[ -n "$T" ] && EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $6}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
else
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $3}')
|
||||
[ -n "$T" ] && EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $7}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $10}')
|
||||
[ -n "$T" ] && RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $8}')
|
||||
[ -n "$T" ] && RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $9}')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
fi
|
||||
|
||||
IDX=1
|
||||
LINES=$(echo "$O" | grep -E "^\+QCAINFO: \"(scc|SCC)\"")
|
||||
for LINE in $LINES; do
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $5}')
|
||||
T3=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $4}')
|
||||
T4=""
|
||||
case $T in
|
||||
*"LTE BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
case $T3 in
|
||||
6*) T4="1.4";;
|
||||
15*) T4="3";;
|
||||
25*) T4="5";;
|
||||
50*) T4="10";;
|
||||
75*) T4="15";;
|
||||
100*) T4="20";;
|
||||
*) T4="";;
|
||||
esac
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
if [ -n "$T5" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1EARFCN="$T5";;
|
||||
2) S2EARFCN="$T5";;
|
||||
3) S3EARFCN="$T5";;
|
||||
4) S4EARFCN="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T5" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$T5";;
|
||||
2) S2PCI="$T5";;
|
||||
3) S3PCI="$T5";;
|
||||
4) S4PCI="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $10}')
|
||||
# [ -n "$T5" ] && addon $((POS + 5)) "(S${IDX}) RSSI" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# [ -n "$T5" ] && addon $((POS + 6)) "(S${IDX}) RSRP" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $9}')
|
||||
# [ -n "$T5" ] && addon $((POS + 7)) "(S${IDX}) RSRQ" "$T5 dB"
|
||||
;;
|
||||
*"NR5G BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G BAND \(.*\)"/\1/')
|
||||
T2=$(band5g ${B})
|
||||
case $T3 in
|
||||
0*) T4="5";;
|
||||
1*) T4="10";;
|
||||
2*) T4="15";;
|
||||
3*) T4="20";;
|
||||
4*) T4="25";;
|
||||
5*) T4="30";;
|
||||
6*) T4="40";;
|
||||
7*) T4="50";;
|
||||
8*) T4="60";;
|
||||
9*) T4="70";;
|
||||
10*) T4="80";;
|
||||
11*) T4="90";;
|
||||
12*) T4="100";;
|
||||
13*) T4="200";;
|
||||
14*) T4="400";;
|
||||
*) T4="";;
|
||||
esac
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
[ -n "$T5" ] && addon $((POS + 4)) "(S${IDX}) EARFCN" "$T5"
|
||||
if [ "x$MODE_NUM" = "x11" ]; then
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T5" ] && [ "$T5" != "-" ]; then
|
||||
case $IDX in
|
||||
1) S1PCI="$T5";;
|
||||
2) S2PCI="$T5";;
|
||||
3) S3PCI="$T5";;
|
||||
4) S4PCI="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 6)) "(S${IDX}) RSRP" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $9}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 7)) "(S${IDX}) RSRQ" "$T5 dB"
|
||||
else
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $6}')
|
||||
if [ -n "$T5" ] && [ "$T5" != "-" ]; then
|
||||
case $IDX in
|
||||
1) S1PCI="$T5";;
|
||||
2) S2PCI="$T5";;
|
||||
3) S3PCI="$T5";;
|
||||
4) S4PCI="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 6)) "(S${IDX}) RSRP" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 7)) "(S${IDX}) RSRQ" "$T5 dB"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2";;
|
||||
2) S2BAND="$T2";;
|
||||
3) S3BAND="$T2";;
|
||||
4) S4BAND="$T2";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2 @$T4 MHz";;
|
||||
2) S2BAND="$T2 @$T4 MHz";;
|
||||
3) S3BAND="$T2 @$T4 MHz";;
|
||||
4) S4BAND="$T2 @$T4 MHz";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1EARFCN="$T";;
|
||||
2) S2EARFCN="$T";;
|
||||
3) S3EARFCN="$T";;
|
||||
4) S4EARFCN="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
TL=$(echo "$LINE" | grep -Eo '[0-9]+' | tail -1)
|
||||
if [ -n "$TL" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$TL";;
|
||||
2) S2PCI="$TL";;
|
||||
3) S3PCI="$TL";;
|
||||
4) S4PCI="$TL";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$T";;
|
||||
2) S2PCI="$T";;
|
||||
3) S3PCI="$T";;
|
||||
4) S4PCI="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
IDX=$((IDX + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,'| sed 's,LTE B,LTE | B,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+GMR "//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM "//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI "//)
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# Slot SIM
|
||||
O=$(sms_tool -d $DEVICE at "AT+QUIMSLOT?")
|
||||
T=$(echo "$O" | awk -F [:] '/^\+QUIMSLOT/{print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SSIM="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+GSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=0800' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
508
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0801
Normal file
@ -0,0 +1,508 @@
|
||||
# Quectel RM520N-GL
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {print $3}' | sort -r | head -n1 | xargs)
|
||||
[ -n "$T" ] && TEMP="$T °C"
|
||||
|
||||
if [ "$REG" = "0" ] || [ "x$MODE_NUM" = "x11" ]; then
|
||||
O=$(sms_tool -d $DEVICE at "at+c5greg=2;+c5greg?")
|
||||
|
||||
# C5GREG
|
||||
eval $(echo "$O" | awk -F[,] '/^\+C5GREG/ {gsub(/[[:space:]"]+/,"");printf "T=\"%d\";TAC_HEX=\"%X\";CID_HEX=\"%s\";TAC_DEC=\"%d\";MODE_NUM=\"%d\"", $2, "0x"$3, $4, "0x"$3, $5}')
|
||||
case "$T" in
|
||||
0*) REG="0";;
|
||||
1*) REG="1";;
|
||||
2*) REG="2";;
|
||||
3*) REG="3";;
|
||||
5*) REG="5";;
|
||||
*) REG="";;
|
||||
esac
|
||||
[ "x$REG" = "x1" ] || [ "x$REG" = "x5" ] && REGOK=1
|
||||
|
||||
[ "$TAC_DEC" != "0" ]
|
||||
[ -n "$CID_HEX" ] && CID_DEC=$(printf "%d" "0x${CID_HEX}")
|
||||
fi
|
||||
|
||||
if [ "$REGOK" = "1" ] || :; then
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qeng=\"servingcell\";+qnwinfo;+qspn;+qcainfo")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
case "$MODE_NUM" in
|
||||
7*)
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*SCC"; then
|
||||
MODE="LTE-A |"
|
||||
fi
|
||||
;;
|
||||
11*)
|
||||
MODE="5G-SA |"
|
||||
;;
|
||||
13*)
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*NR5G"; then
|
||||
MODE="5G-NSA |"
|
||||
else
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*PCC.*LTE"; then
|
||||
MODE="LTE |"
|
||||
|
||||
OTS=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$OTS
|
||||
|
||||
TDX=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
TAC_DEC=$(printf "%d" "0x$TDX")
|
||||
TAC_HEX=$TDX
|
||||
|
||||
if echo "$O" | grep -q -i "+QCAINFO.*SCC"; then
|
||||
MODE="LTE-A |"
|
||||
|
||||
OTS=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$OTS
|
||||
|
||||
TDX=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
TAC_DEC=$(printf "%d" "0x$TDX")
|
||||
TAC_HEX=$TDX
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"LTE BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
MODE="$MODE $(band ${B})"
|
||||
;;
|
||||
*"NR5G BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G BAND \(.*\)"/\1/')
|
||||
MODE="$MODE $(band5g ${B})"
|
||||
;;
|
||||
esac
|
||||
|
||||
T1=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{gsub(" ", "-");print $5}')
|
||||
if [ -n "$T1" ]; then
|
||||
for T in $T1; do
|
||||
case $T in
|
||||
*"LTE-BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE-BAND-\(.*\)"/\1/')
|
||||
MODE="$MODE / $(band ${B})"
|
||||
;;
|
||||
*"NR5G-BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G-BAND-\(.*\)"/\1/')
|
||||
MODE="$MODE / $(band5g ${B})"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
TAC_DEC=$(printf "%d" "0x$T")
|
||||
TAC_HEX=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && DLBW="DL: @$T1 MHz"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$MODE_NUM" = "x11" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xNR5G-SA" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $8}')
|
||||
if [ -n "$T" ]; then
|
||||
CID_HEX=$T
|
||||
CID_DEC=$(printf "%d" "0x${CID_HEX}")
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0) BW="5";;
|
||||
1) BW="10";;
|
||||
2) BW="15";;
|
||||
3) BW="20";;
|
||||
4) BW="25";;
|
||||
5) BW="30";;
|
||||
6) BW="40";;
|
||||
7) BW="50";;
|
||||
8) BW="60";;
|
||||
9) BW="70";;
|
||||
10) BW="80";;
|
||||
11) BW="90";;
|
||||
12) BW="100";;
|
||||
13) BW="200";;
|
||||
14) BW="400";;
|
||||
*) BW="";;
|
||||
esac
|
||||
[ -n "$BW" ] && DBW="@$BW MHz"
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$T
|
||||
if [ -n "$BW" ]; then
|
||||
N=$((BW * 5))
|
||||
RSSI=$(echo "$T $N" | awk '{printf "%d\n", $1 + 10*log(12*$2)/log(10)}')
|
||||
if [ -n "$RSSI" ]; then
|
||||
_RSSI=$RSSI
|
||||
[ $_RSSI -lt -113 ] && _RSSI="-113"
|
||||
[ $_RSSI -gt -51 ] && _RSSI="-51"
|
||||
[ -z "$CSQ_PER" ] && CSQ_PER=$(((_RSSI + 113) * 100 / 62 ))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}')
|
||||
[ -n "$T" ] && SINR=$T
|
||||
fi
|
||||
fi
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
if [ "x$MODE_NUM" = "x13" ]; then
|
||||
LINES=$(echo "$O" | grep "+QENG")
|
||||
for LINE in $LINES; do
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/{print $2}' | xargs)
|
||||
if [ "x$T" = "xLTE" ]; then
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
TAC_DEC=$(printf "%d" "0x$T")
|
||||
TAC_HEX=$T
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $16}' | awk '{printf "%.0f\n", 0.2*$1*10 - 20}')
|
||||
SINR=$T
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $10}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QENG:/ {print $11}')
|
||||
case $T in
|
||||
0*) T1="1.4";;
|
||||
1*) T1="3";;
|
||||
2*) T1="5";;
|
||||
3*) T1="10";;
|
||||
4*) T1="15";;
|
||||
5*) T1="20";;
|
||||
*) T1="";;
|
||||
esac
|
||||
[ -n "$T1" ] && DLBW="DL: @$T1 MHz"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $5}')
|
||||
test -n "$T" || T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO: "/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"LTE BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
;;
|
||||
*"NR5G BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G BAND \(.*\)"/\1/')
|
||||
T2=$(band5g ${B})
|
||||
;;
|
||||
esac
|
||||
T3=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $4}')
|
||||
case $T3 in
|
||||
6*) T4="1.4";;
|
||||
15*) T4="3";;
|
||||
25*) T4="5";;
|
||||
50*) T4="10";;
|
||||
75*) T4="15";;
|
||||
100*) T4="20";;
|
||||
*) T4="";;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
PBAND="$T2"
|
||||
if [ -n "$DBW" ]; then
|
||||
PBAND="$T2 $DBW"
|
||||
fi
|
||||
else
|
||||
PBAND="$T2 @$T4 MHz"
|
||||
fi
|
||||
if [ "x$MODE_NUM" = "x11" ]; then
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $3}')
|
||||
[ -n "$T" ] && EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $6}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
else
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $3}')
|
||||
[ -n "$T" ] && EARFCN=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $7}')
|
||||
[ -n "$T" ] && PCI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $10}')
|
||||
[ -n "$T" ] && RSSI=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $8}')
|
||||
[ -n "$T" ] && RSRP=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QCAINFO: "(pcc|PCC)"/{print $9}')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
fi
|
||||
|
||||
IDX=1
|
||||
LINES=$(echo "$O" | grep -E "^\+QCAINFO: \"(scc|SCC)\"")
|
||||
for LINE in $LINES; do
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $5}')
|
||||
T3=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $4}')
|
||||
T4=""
|
||||
case $T in
|
||||
*"LTE BAND"*)
|
||||
B=$(echo $T | sed 's/"LTE BAND \(.*\)"/\1/')
|
||||
T2=$(band ${B})
|
||||
case $T3 in
|
||||
6*) T4="1.4";;
|
||||
15*) T4="3";;
|
||||
25*) T4="5";;
|
||||
50*) T4="10";;
|
||||
75*) T4="15";;
|
||||
100*) T4="20";;
|
||||
*) T4="";;
|
||||
esac
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
if [ -n "$T5" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1EARFCN="$T5";;
|
||||
2) S2EARFCN="$T5";;
|
||||
3) S3EARFCN="$T5";;
|
||||
4) S4EARFCN="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T5" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$T5";;
|
||||
2) S2PCI="$T5";;
|
||||
3) S3PCI="$T5";;
|
||||
4) S4PCI="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $10}')
|
||||
# [ -n "$T5" ] && addon $((POS + 5)) "(S${IDX}) RSSI" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# [ -n "$T5" ] && addon $((POS + 6)) "(S${IDX}) RSRP" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $9}')
|
||||
# [ -n "$T5" ] && addon $((POS + 7)) "(S${IDX}) RSRQ" "$T5 dB"
|
||||
;;
|
||||
*"NR5G BAND"*)
|
||||
B=$(echo $T | sed 's/"NR5G BAND \(.*\)"/\1/')
|
||||
T2=$(band5g ${B})
|
||||
case $T3 in
|
||||
0*) T4="5";;
|
||||
1*) T4="10";;
|
||||
2*) T4="15";;
|
||||
3*) T4="20";;
|
||||
4*) T4="25";;
|
||||
5*) T4="30";;
|
||||
6*) T4="40";;
|
||||
7*) T4="50";;
|
||||
8*) T4="60";;
|
||||
9*) T4="70";;
|
||||
10*) T4="80";;
|
||||
11*) T4="90";;
|
||||
12*) T4="100";;
|
||||
13*) T4="200";;
|
||||
14*) T4="400";;
|
||||
*) T4="";;
|
||||
esac
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
[ -n "$T5" ] && addon $((POS + 4)) "(S${IDX}) EARFCN" "$T5"
|
||||
if [ "x$MODE_NUM" = "x11" ]; then
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T5" ] && [ "$T5" != "-" ]; then
|
||||
case $IDX in
|
||||
1) S1PCI="$T5";;
|
||||
2) S2PCI="$T5";;
|
||||
3) S3PCI="$T5";;
|
||||
4) S4PCI="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 6)) "(S${IDX}) RSRP" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $9}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 7)) "(S${IDX}) RSRQ" "$T5 dB"
|
||||
else
|
||||
T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $6}')
|
||||
if [ -n "$T5" ] && [ "$T5" != "-" ]; then
|
||||
case $IDX in
|
||||
1) S1PCI="$T5";;
|
||||
2) S2PCI="$T5";;
|
||||
3) S3PCI="$T5";;
|
||||
4) S4PCI="$T5";;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 6)) "(S${IDX}) RSRP" "$T5 dBm"
|
||||
# T5=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $8}')
|
||||
# [ -n "$T5" ] && [ "$T5" != "-" ] && addon $((POS + 7)) "(S${IDX}) RSRQ" "$T5 dB"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ -z "$T4" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2";;
|
||||
2) S2BAND="$T2";;
|
||||
3) S3BAND="$T2";;
|
||||
4) S4BAND="$T2";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case $IDX in
|
||||
1) S1BAND="$T2 @$T4 MHz";;
|
||||
2) S2BAND="$T2 @$T4 MHz";;
|
||||
3) S3BAND="$T2 @$T4 MHz";;
|
||||
4) S4BAND="$T2 @$T4 MHz";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1EARFCN="$T";;
|
||||
2) S2EARFCN="$T";;
|
||||
3) S3EARFCN="$T";;
|
||||
4) S4EARFCN="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
TL=$(echo "$LINE" | grep -Eo '[0-9]+' | tail -1)
|
||||
if [ -n "$TL" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$TL";;
|
||||
2) S2PCI="$TL";;
|
||||
3) S3PCI="$TL";;
|
||||
4) S4PCI="$TL";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[,:] '/^\+QCAINFO: "(scc|SCC)"/{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
1) S1PCI="$T";;
|
||||
2) S2PCI="$T";;
|
||||
3) S3PCI="$T";;
|
||||
4) S4PCI="$T";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
IDX=$((IDX + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,'| sed 's,LTE B,LTE | B,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+GMR "//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM "//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI "//)
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# Slot SIM
|
||||
O=$(sms_tool -d $DEVICE at "AT+QUIMSLOT?")
|
||||
T=$(echo "$O" | awk -F [:] '/^\+QUIMSLOT/{print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
SSIM="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+GSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=0801' '{print $2}' | cut -c-1290)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
116
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c6026
Normal file
@ -0,0 +1,116 @@
|
||||
# Quectel EC200T
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qtemp")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {print $2}' | sort -r | head -n1 | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+qnwinfo;+qspn")
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO/ {print $2"/"$4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
B=$(echo $T | sed 's/.*LTE BAND \(.*\)/\1/')
|
||||
MODE="LTE | $(band ${B})"
|
||||
MAINCUT="$(band ${B})"
|
||||
fi
|
||||
fi
|
||||
|
||||
E=$(sms_tool -d $DEVICE at "at+qeng=\"servingcell\"")
|
||||
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs)
|
||||
if [ "x$T" = "xLTE" ] || [ "x$T" = "x4G" ]; then
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $14}')
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $12}')
|
||||
case $T in
|
||||
0) T1="1.4";;
|
||||
1) T1="3";;
|
||||
2) T1="5";;
|
||||
3) T1="10";;
|
||||
4) T1="15";;
|
||||
5) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
ULBW="UL: @$T1 MHz"
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $13}')
|
||||
case $T in
|
||||
0) T1="1.4";;
|
||||
1) T1="3";;
|
||||
2) T1="5";;
|
||||
3) T1="10";;
|
||||
4) T1="15";;
|
||||
5) T1="20";;
|
||||
*) T1="?";;
|
||||
esac
|
||||
DLBW="DL: @$T1 MHz"
|
||||
PBAND="$MAINCUT $DLBW $ULBW"
|
||||
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $9}')
|
||||
PCI=$T
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $10}')
|
||||
EARFCN=$T
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $17}')
|
||||
RSSI=$T
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $15}')
|
||||
RSRP=$T
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $16}')
|
||||
RSRQ=$T
|
||||
T=$(echo "$E" | awk -F[,:] '/^\+QENG:/ {print $18}')
|
||||
SINR=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs)
|
||||
if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then
|
||||
COPS="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed 's/AT+GSN//g' | xargs)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed 's/AT+CIMI//g' | xargs)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+QCCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+QCCID/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+GMR"//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM"//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI"//)
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2c7c ProdID=6026' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
205
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cb70104
Normal file
@ -0,0 +1,205 @@
|
||||
# Fibocom FM150-AE
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+gtccinfo?;+gtcainfo?")
|
||||
|
||||
if [ "x$MODE" = "xLTE" ]; then
|
||||
if [[ "$O" == *"SCC"* ]]; then
|
||||
MODE="LTE_A"
|
||||
fi
|
||||
T1=$(echo "$O" | grep -A 3 'LTE service cell' | grep '1,4,'${COPS_MCC}','${COPS_MNC}',')
|
||||
if [ -n "$T1" ]; then
|
||||
T=$(echo "$T1" | awk -F, '{print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $8}')
|
||||
if [ -n "$T" ]; then
|
||||
PCI=$T
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
EARFCN=$T
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $11}')
|
||||
if [ -n "$T" ]; then
|
||||
if [ $T -ge -100 ] || [ $T -le 100 ]; then
|
||||
T=$(echo "$T" | awk -F, '{printf "%0.1f", $T/2}')
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $13}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$((T - 141))
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $14}')
|
||||
if [ -n "$T" ]; then
|
||||
T2=$(echo "$T" | awk '{printf "%0.1f", ($1-34)/2-3 }')
|
||||
RSRQ=$T2
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $11}')
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T2=$(echo "$T" | awk '{printf "%0.1f", $1/4+5 }')
|
||||
SINR=$T2
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $14}')
|
||||
if [ -n "$T" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
T2=$(echo "$T" | awk '{printf "%0.1f", $1-110 }')
|
||||
RSSI=$T2
|
||||
fi
|
||||
|
||||
T=$(echo "$T1" | awk -F, '{print $9}')
|
||||
if [ -n "$T" ]; then
|
||||
T=$((T - 100))
|
||||
|
||||
case $T in
|
||||
*"1") MODE="$MODE | "$(band 1 "");;
|
||||
*"2") MODE="$MODE | "$(band 2 "");;
|
||||
*"3") MODE="$MODE | "$(band 3 "");;
|
||||
*"5") MODE="$MODE | "$(band 5 "");;
|
||||
*"7") MODE="$MODE | "$(band 7 "");;
|
||||
*"8") MODE="$MODE | "$(band 8 "");;
|
||||
*"18") MODE="$MODE | "$(band 18 "");;
|
||||
*"19") MODE="$MODE | "$(band 19 "");;
|
||||
*"20") MODE="$MODE | "$(band 20 "");;
|
||||
*"28") MODE="$MODE | "$(band 28 "");;
|
||||
*"32") MODE="$MODE | "$(band 32 "");;
|
||||
*"34") MODE="$MODE | "$(band 34 "");;
|
||||
*"38") MODE="$MODE | "$(band 38 "");;
|
||||
*"39") MODE="$MODE | "$(band 39 "");;
|
||||
*"40") MODE="$MODE | "$(band 40 "");;
|
||||
*"41") MODE="$MODE | "$(band 41 "");;
|
||||
*"42") MODE="$MODE | "$(band 42 "");;
|
||||
*"43") MODE="$MODE | "$(band 43 "");;
|
||||
*) MODE="$MODE / B${T}";;
|
||||
esac
|
||||
PBAND="$(band $T "")"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[:,] '/^PCC/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
PCI=$T
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[:,] '/^PCC/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
EARFCN=$T
|
||||
fi
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
IDX=1
|
||||
LINES=$(echo "$O" | grep -E "^SCC[0-9]: ")
|
||||
for LINE in $LINES; do
|
||||
T=$(echo "$LINE" | awk -F[:,] '/^SCC'$IDX': 1,0/{print $4}')
|
||||
T=$((T - 100))
|
||||
|
||||
case $T in
|
||||
"1") T2=$(band 1 "");;
|
||||
"2") T2=$(band 2 "");;
|
||||
"3") T2=$(band 3 "");;
|
||||
"5") T2=$(band 5 "");;
|
||||
"7") T2=$(band 7 "");;
|
||||
"8") T2=$(band 8 "");;
|
||||
"18") T2=$(band 18 "");;
|
||||
"19") T2=$(band 19 "");;
|
||||
"20") T2=$(band 20 "");;
|
||||
"28") T2=$(band 28 "");;
|
||||
"32") T2=$(band 32 "");;
|
||||
"34") T2=$(band 34 "");;
|
||||
"38") T2=$(band 38 "");;
|
||||
"39") T2=$(band 39 "");;
|
||||
"40") T2=$(band 40 "");;
|
||||
"41") T2=$(band 41 "");;
|
||||
"42") T2=$(band 42 "");;
|
||||
"43") T2=$(band 43 "");;
|
||||
*) T2="B${T}";;
|
||||
esac
|
||||
MODE="$MODE / $T2"
|
||||
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
"1") S1BAND="$T2";;
|
||||
"2") S2BAND="$T2";;
|
||||
"3") S3BAND="$T2";;
|
||||
"4") S4BAND="$T2";;
|
||||
*);;
|
||||
esac
|
||||
|
||||
case $IDX in
|
||||
"1") S1PCI="$T";;
|
||||
"2") S2PCI="$T";;
|
||||
"3") S3PCI="$T";;
|
||||
"4") S4PCI="$T";;
|
||||
*);;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[:,] '/^SCC'$IDX': 1,0/{print $6}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
"1") S1EARFCN="$T";;
|
||||
"2") S2EARFCN="$T";;
|
||||
"3") S3EARFCN="$T";;
|
||||
"4") S4EARFCN="$T";;
|
||||
*);;
|
||||
esac
|
||||
|
||||
fi
|
||||
IDX=$((IDX + 1))
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A /LTE-A /g" | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
OA=$(sms_tool -d $DEVICE at "AT+CGMM?")
|
||||
MODELA=$(echo "$OA" | awk -F [:,] '/\+CGMM/{print $2}' | xargs)
|
||||
OB=$(sms_tool -d $DEVICE at "AT+CGMI?")
|
||||
MODELB=$(echo "$OB" | awk -F [:,] '/\+CGMI/{print $2}' | xargs)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"Wireless Inc."//)
|
||||
MODEL="$MODELBCUT $MODELA"
|
||||
|
||||
OF=$(sms_tool -d $DEVICE at "AT+GMR?")
|
||||
FW=$(echo "$OF" | awk -F[,:] '/\+GMR:/ {print $2}' | xargs)
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
OAA=$(sms_tool -d $DEVICE at "AT+CGSN?")
|
||||
NR_IMEI=$(echo "$OAA" | awk -F[,:] '/\+CGSN:/ {print $2}' | xargs)
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
OBB=$(sms_tool -d $DEVICE at "AT+CIMI?")
|
||||
NR_IMSI=$(echo "$OBB" | awk -F [,:] '/\+CIMI:/ {print $2}' | xargs)
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
OCC=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_ICCID=$(echo "$OCC" | awk -F [,:] '/\+ICCID:/ {print $2}' | xargs)
|
||||
|
||||
# Temp
|
||||
OT=$(sms_tool -d $DEVICE at "AT+MTSM=1")
|
||||
TX=$(echo "$OT" | awk '/\+MTSM:/{print $2}')
|
||||
if [ -n "$TX" ]; then
|
||||
TEMP="$TX °C"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2cb7 ProdID=0104' '{print $2}' | cut -c-1290)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
176
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cb70105
Normal file
@ -0,0 +1,176 @@
|
||||
# Fibocom modems with ProdID=0105
|
||||
# NL952-EAU in ECM mode (LTE CAT18)
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "AT+GTCCINFO?;+GTCAINFO?")
|
||||
|
||||
if [ "x$MODE" = "xLTE" ]; then
|
||||
if [[ "$O" == *"SCC"* ]]; then
|
||||
MODE="LTE_A"
|
||||
fi
|
||||
T1=$(echo "$O" | grep -A 3 'LTE service cell' | grep '1,4,'${COPS_MCC}','${COPS_MNC}',')
|
||||
if [ -n "$T1" ]; then
|
||||
T=$(echo "$T1" | awk -F, '{print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
LAC_DEC=""
|
||||
LAC_HEX=""
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $7}')
|
||||
if [ -n "$T" ]; then
|
||||
EARFCN=$T
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $8}')
|
||||
if [ -n "$T" ]; then
|
||||
PCI=$T
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $9}')
|
||||
if [ -n "$T" ]; then
|
||||
T=$((T - 100))
|
||||
MODE="$MODE | $(band $T)"
|
||||
PBAND="$(band $T "")"
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $11}')
|
||||
if [ -n "$T" ]; then
|
||||
T2=$(echo "$T" | awk '{printf "%0.1f", $1/2 }')
|
||||
SINR=$T2
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $13}')
|
||||
if [ -n "$T" ]; then
|
||||
RSRP=$((T - 141))
|
||||
fi
|
||||
T=$(echo "$T1" | awk -F, '{print $14}')
|
||||
if [ -n "$T" ]; then
|
||||
T2=$(echo "$T" | awk '{printf "%0.1f", ($1-34)/2-3 }')
|
||||
RSRQ=$T2
|
||||
fi
|
||||
|
||||
if [ -n "$CSQ" ]; then
|
||||
RSSI=$((2 * $CSQ -113))
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[:,] '/^PCC/{print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
PCI=$T
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[:,] '/^PCC/{print $4}')
|
||||
if [ -n "$T" ]; then
|
||||
EARFCN=$T
|
||||
fi
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
IDX=1
|
||||
LINES=$(echo "$O" | grep -E "^SCC[0-9]: 2")
|
||||
for LINE in $LINES; do
|
||||
T=$(echo "$LINE" | awk -F[:,] '/^SCC'$IDX': 2,./{print $4}')
|
||||
T=$((T - 100))
|
||||
|
||||
T2=$(band $T)
|
||||
MODE="$MODE / $T2"
|
||||
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
"1") S1BAND="$T2";;
|
||||
"2") S2BAND="$T2";;
|
||||
"3") S3BAND="$T2";;
|
||||
"4") S4BAND="$T2";;
|
||||
*);;
|
||||
esac
|
||||
|
||||
case $IDX in
|
||||
"1") S1PCI="$T";;
|
||||
"2") S2PCI="$T";;
|
||||
"3") S3PCI="$T";;
|
||||
"4") S4PCI="$T";;
|
||||
*);;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
T=$(echo "$LINE" | awk -F[:,] '/^SCC'$IDX': 2,./{print $6}')
|
||||
if [ -n "$T" ]; then
|
||||
|
||||
case $IDX in
|
||||
"1") S1EARFCN="$T";;
|
||||
"2") S2EARFCN="$T";;
|
||||
"3") S3EARFCN="$T";;
|
||||
"4") S4EARFCN="$T";;
|
||||
*);;
|
||||
esac
|
||||
|
||||
fi
|
||||
IDX=$((IDX + 1))
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A /LTE-A /g" | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
OA=$(sms_tool -d $DEVICE at "AT+CGMM?")
|
||||
MODELA=$(echo "$OA" | awk -F [:,] '/\+CGMM/{print $2}' | xargs)
|
||||
OB=$(sms_tool -d $DEVICE at "AT+CGMI?")
|
||||
MODELB=$(echo "$OB" | awk -F [:,] '/\+CGMI/{print $2}' | xargs)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"Wireless Inc."//)
|
||||
MODEL="$MODELBCUT $MODELA"
|
||||
|
||||
OF=$(sms_tool -d $DEVICE at "AT+GMR?")
|
||||
FW=$(echo "$OF" | awk -F[,:] '/\+GMR:/ {print $2}' | xargs)
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
OAA=$(sms_tool -d $DEVICE at "AT+CGSN?")
|
||||
NR_IMEI=$(echo "$OAA" | awk -F[,:] '/\+CGSN:/ {print $2}' | xargs)
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
OBB=$(sms_tool -d $DEVICE at "AT+CIMI?")
|
||||
NR_IMSI=$(echo "$OBB" | awk -F [,:] '/\+CIMI:/ {print $2}' | xargs)
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
OCC=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_ICCID=$(echo "$OCC" | awk -F [,:] '/\+ICCID:/ {print $2}' | xargs)
|
||||
|
||||
# Temp
|
||||
OT=$(sms_tool -d $DEVICE at "AT+MTSM=1")
|
||||
TM=$(echo "$OT" | awk '/\+MTSM:/{print $2}')
|
||||
if [ -n "$TM" ]; then
|
||||
TEMP="$TM °C"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
|
||||
TTY=$(basename $DEVICE)
|
||||
devpath=$(readlink -f /sys/class/tty/$TTY/device)
|
||||
BASE=$(readlink -f ${devpath%/*/*})
|
||||
|
||||
NETIF=$(for a in /sys/class/net/*; do readlink -f $a; done | grep "$BASE")
|
||||
NETDRV=$(basename $(readlink -f $NETIF/../../driver))
|
||||
|
||||
case $NETDRV in
|
||||
"qmi_wwan")
|
||||
PROTO="QMI";;
|
||||
"cdc_mbim")
|
||||
PROTO="MBIM";;
|
||||
"cdc_ether")
|
||||
PROTO="ECM";;
|
||||
esac
|
||||
|
||||
|
||||
#PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
#PVCUT=$(echo $PV | awk -F 'Vendor=2cb7 ProdID=0105' '{print $2}' | cut -c-1290)
|
||||
#if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
#then
|
||||
# PROTO="qmi"
|
||||
#elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
#then
|
||||
# PROTO="mbim"
|
||||
#elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
#then
|
||||
# PROTO="ecm"
|
||||
#fi
|
@ -0,0 +1,53 @@
|
||||
# Mikrotik R11e-LTE
|
||||
|
||||
# COPS numeric
|
||||
COPS_NUM=$(echo "$O" | awk -F[\"] '/^\+COPS: \(.,2/ {print $2}')
|
||||
if [ "x$COPS_NUM" = "x" ]; then
|
||||
COPS_NUM="-"
|
||||
COPS_MCC="-"
|
||||
COPS_MNC="-"
|
||||
else
|
||||
COPS_MCC=${COPS_NUM:0:3}
|
||||
COPS_MNC=${COPS_NUM:3:3}
|
||||
COPS=$(awk -F[\;] '/'$COPS_NUM'/ {print $2}' $RES/mccmnc.dat)
|
||||
fi
|
||||
[ "x$COPS" = "x" ] && COPS=$COPS_NUM
|
||||
|
||||
if [ -z "$FORCE_PLMN" ]; then
|
||||
# COPS alphanumeric
|
||||
T=$(echo "$O" | awk -F[\"] '/^\+COPS: \(.,0/ {print $2}')
|
||||
[ "x$T" != "x" ] && COPS="$T"
|
||||
fi
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+cesq")
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "255" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSCP="-'$T'"
|
||||
ADDON="$ADDON"'{"RSCP":"-'$T' dBm"}'
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $5}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "255" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
ADDON="$ADDON"'{"ECNO":"-'$T' dB"}'
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $6}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "255" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRQ="-'$T'"
|
||||
ADDON="$ADDON"'{"RSRQ":"-'$T' dB"}'
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $7}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "255" ]; then
|
||||
[ -n "$ADDON" ] && ADDON="$ADDON,"
|
||||
RSRP="-'$T'"
|
||||
ADDON="$ADDON"'{"RSRP":"-'$T' dBm"}'
|
||||
fi
|
||||
fi
|
101
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cd20004
Normal file
@ -0,0 +1,101 @@
|
||||
# Mikrotik R11e-LTE6
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+cesq;+zcainfo?;+zpas?;+zcellinfo?")
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ "$T" != "99" ] && RSSI="$((T - 111))"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $4}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ "$T" != "255" ] && RSCP="$((T - 121))"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $5}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "255" ]; then
|
||||
T=$(echo "$T" | awk '{printf "%.1f", -1 * (24.5 - $1 * 0.5)}')
|
||||
ECIO="$T dB"
|
||||
fi
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $7}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
[ "$T" != "255" ] && RSRP="$((T - 141))"
|
||||
fi
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $6}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "255" ]; then
|
||||
T=$(echo "$T" | awk '{printf "%.1f", -1 * (20 - $1 * 0.5)}')
|
||||
RSRQ="$T"
|
||||
SINR=""
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZPAS/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
MODE=$T
|
||||
T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs)
|
||||
if [ "x$MODE_NUM" = "x7" ] || [ "x$MODE_NUM" = "x9" ]; then
|
||||
MODE="$MODE $(band ${T/LTE B/})"
|
||||
PBAND="$(band ${T/LTE B/})"
|
||||
else
|
||||
MODE="$MODE $T"
|
||||
PBAND="$(band ${T})"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$MODE_NUM" in
|
||||
9*)
|
||||
T=$(echo "$O" | awk -F[,] '/^\+ZCAINFO: /{print $11}')
|
||||
if [ -n "$T" ]; then
|
||||
if [ "$T" != "0" ]; then
|
||||
MODE="$MODE / $(band ${T})"
|
||||
S1BAND="$(band ${T})"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed "s/LTE_A/LTE-A | /g")
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+CGMR" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+CGMR"//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | xargs)
|
||||
MODELACUT=$(echo $MODELA | awk -F [:] '/^\+CGMM:/{print $2}' | xargs)
|
||||
MODELBCUT=$(echo $MODELB | awk -F [:] '/^\+CGMI:/{print $2}' | xargs)
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# LAC & TAC
|
||||
T_HEX=$LAC_HEX
|
||||
T_DEC=$LAC_DEC
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+CGSN"//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI"//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT*ICCID?")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\*ICCID:/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=2cd2 ProdID=0004' '{print $2}' | cut -c-1220)
|
||||
if echo "$PVCUT" | grep -q "Driver=rndis_host"
|
||||
then
|
||||
PROTO="ncm"
|
||||
fi
|
102
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/413c81b1
Normal file
@ -0,0 +1,102 @@
|
||||
# DW5809e Dell Wireless 5809e Gobi 4G LTE Mobile Broadband Card (EM7305)
|
||||
# DW5811e Snapdragon X7 LTE (EM7455B)
|
||||
# Sierra Wireless EM7455
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at!gstatus?")
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk '/.*TAC:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX="$T"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^PCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && RSSI="$(echo "${T// //}" | sed 's,/.*,,')"
|
||||
T=$(echo "$O" | awk '/^PCC.*RSRP/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && RSRP="$(echo "${T// //}" | sed 's,/.*,,')"
|
||||
T=$(echo "$O" | awk '/^RSRQ/ {print $3}')
|
||||
[ -n "$T" ] && RSRQ="$T"
|
||||
T=$(echo "$O" | awk '/^SINR/ {print $3}')
|
||||
[ -n "$T" ] && SINR="$T"
|
||||
|
||||
T=$(echo "$O" | awk '/^LTE band:/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE band:/ {print $6}')
|
||||
PBAND="$(band ${T/B/}) @${T1} MHz"
|
||||
MODE="$MODE $(band ${T/B/})"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/^LTE CA state:.*ACTIVE/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE Scell bw:/ {print $3}')
|
||||
if [ -n "$T1" ]; then
|
||||
S1BAND="$(band ${T/B/}) @${T1#bw:} MHz"
|
||||
else
|
||||
S1BAND="$(band ${T/B/})"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T/B/})"
|
||||
|
||||
T=$(echo "$O" | awk '/.*LTE Scell chan:/ {print $7}')
|
||||
[ -n "$T" ] && EARFCN="${T#chan:}"
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && RSSI=$(echo "${T// //}" | sed 's,/.*,,')
|
||||
T=$(echo "$O" | awk '/^SCC.*RSRP/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && RSRP=$(echo "${T// //}" | sed 's,/.*,,')
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+CGMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+CGMR "//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM "//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI "// | cut -f1 -d",")
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+CGSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$O" | awk -F[,:] '/^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=413c ProdID=81b1' '{print $2}' | cut -c-1100)
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
103
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/413c81b6
Normal file
@ -0,0 +1,103 @@
|
||||
# DW5809e Dell Wireless 5809e Gobi 4G LTE Mobile Broadband Card (EM7305)
|
||||
# DW5811e Snapdragon X7 LTE (EM7455B)
|
||||
# Sierra Wireless EM7455
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at!gstatus?")
|
||||
|
||||
if [ "x$MODE_NUM" = "x7" ]; then
|
||||
T=$(echo "$O" | awk '/.*TAC:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX="$T"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^PCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && RSSI="$(echo "${T// //}" | sed 's,/.*,,')"
|
||||
T=$(echo "$O" | awk '/^PCC.*RSRP/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && RSRP="$(echo "${T// //}" | sed 's,/.*,,')"
|
||||
T=$(echo "$O" | awk '/^RSRQ/ {print $3}')
|
||||
[ -n "$T" ] && RSRQ="$T"
|
||||
T=$(echo "$O" | awk '/^SINR/ {print $3}')
|
||||
[ -n "$T" ] && SINR="$T"
|
||||
|
||||
T=$(echo "$O" | awk '/^LTE band:/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE band:/ {print $6}')
|
||||
PBAND="$(band ${T/B/}) @${T1} MHz"
|
||||
MODE="$MODE $(band ${T/B/})"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/^LTE CA state:.*ACTIVE/ {print $3}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^LTE Scell bw:/ {print $3}')
|
||||
if [ -n "$T1" ]; then
|
||||
S1BAND="$(band ${T/B/}) @${T1#bw:} MHz"
|
||||
else
|
||||
S1BAND="$(band ${T/B/})"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band ${T/B/})"
|
||||
|
||||
T=$(echo "$O" | awk '/.*LTE Scell chan:/ {print $7}')
|
||||
[ -n "$T" ] && EARFCN="${T#chan:}"
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC.*RSSI/ {print $4}' | xargs)
|
||||
[ -n "$T" ] && RSSI=$(echo "${T// //}" | sed 's,/.*,,')
|
||||
T=$(echo "$O" | awk '/^SCC.*RSRP/ {print $7}' | xargs)
|
||||
[ -n "$T" ] && RSRP=$(echo "${T// //}" | sed 's,/.*,,')
|
||||
fi
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+CGMR" | tr -s "\n" | xargs)
|
||||
FW=$(echo $FWA | sed s/"AT+CGMR "//)
|
||||
|
||||
MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | tr -s "\n" | xargs)
|
||||
MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | tr -s "\n" | xargs)
|
||||
|
||||
MODELACUT=$(echo $MODELA | sed s/"AT+CGMM "//)
|
||||
MODELBCUT=$(echo $MODELB | sed s/"AT+CGMI "// | cut -f1 -d",")
|
||||
MODEL="$MODELBCUT "$MODELACUT
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+CGSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID")
|
||||
NR_D=$(echo "$O" | awk -F[,:] '/^ICCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=413c ProdID=81b6' '{print $2}' | cut -c-1290)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
153
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/413c81d7
Normal file
@ -0,0 +1,153 @@
|
||||
# DW5821e Snapdragon X20 LTE
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at^ca_info?;^debug?")
|
||||
|
||||
T=$(echo "$O" | awk '/TAC:/ {print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
T_DEC=$(printf "%d" "0x$T")
|
||||
T_HEX=$T
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^RSSI:/ {print $2}' | sed 's/dBm/ dBm/')
|
||||
[ -n "$T" ] && RSSI=$T
|
||||
T=$(echo "$O" | awk '/^RSRP:/ {print $2}' | sed 's/dBm/ dBm/')
|
||||
[ -n "$T" ] && RSRP=$T
|
||||
T=$(echo "$O" | awk '/^RSRQ:/ {print $2}' | sed 's/dB/ dB/')
|
||||
[ -n "$T" ] && RSRQ=$T
|
||||
T=$(echo "$O" | awk '/^RS-SINR/ {print $2}' | sed 's/dB/ dB/')
|
||||
[ -n "$T" ] && SINR=$T
|
||||
|
||||
T=$(echo "$O" | awk '/^BAND:/ {print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
T1=$(echo "$O" | awk '/^BW:/ {print $2}')
|
||||
PBAND="$(band $T) @${T1} MHz"
|
||||
MODE="$MODE $(band $T)"
|
||||
fi
|
||||
T=$(echo "$O" | awk '/^EARFCN/ {print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
# addon 34 "EARFCN DL" "$(echo $T | cut -f1 -d/)"
|
||||
# addon 34 "EARFCN UL" "$(echo $T | cut -f2 -d/)"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC1 info:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T=${T/,/}
|
||||
T=${T/LTE_B/}
|
||||
T1=$(echo "$O" | awk '/^SCC1 info:/ {print $8}')
|
||||
if [ -n "$T1" ]; then
|
||||
S1BAND="$(band $T) @${T1} MHz"
|
||||
else
|
||||
S1BAND="$(band $T)"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band $T)"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC2 info:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T=${T/,/}
|
||||
T=${T/LTE_B/}
|
||||
T1=$(echo "$O" | awk '/^SCC2 info:/ {print $8}')
|
||||
if [ -n "$T1" ]; then
|
||||
S2BAND="$(band $T) @${T1} MHz"
|
||||
else
|
||||
S2BAND="$(band $T)"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band $T)"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC3 info:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T=${T/,/}
|
||||
T=${T/LTE_B/}
|
||||
T1=$(echo "$O" | awk '/^SCC3 info:/ {print $8}')
|
||||
if [ -n "$T1" ]; then
|
||||
S3BAND="$(band $T) @${T1} MHz"
|
||||
else
|
||||
S3BAND="$(band $T)"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band $T)"
|
||||
fi
|
||||
|
||||
T=$(echo "$O" | awk '/^SCC4 info:/ {print $5}')
|
||||
if [ -n "$T" ]; then
|
||||
T=${T/,/}
|
||||
T=${T/LTE_B/}
|
||||
T1=$(echo "$O" | awk '/^SCC4 info:/ {print $8}')
|
||||
if [ -n "$T1" ]; then
|
||||
S4BAND="$(band $T) @${T1} MHz"
|
||||
else
|
||||
S4BAND="$(band $T)"
|
||||
fi
|
||||
MODE="${MODE/LTE/LTE_A} / $(band $T)"
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A | ,')
|
||||
|
||||
# Cell ID & LAC & TAC
|
||||
LAC_HEX=$(printf "%X" $LAC_DEC)
|
||||
if [ -n "$LAC_DEC" ]; then
|
||||
TAC_HEX=$LAC_HEX
|
||||
fi
|
||||
CID_HEX=$(printf "%X" $CID_DEC)
|
||||
|
||||
T=$(echo "$O" | awk -F: '/xo_therm_buf:/ {print $2}' | xargs)
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices)
|
||||
PVCUT=$(echo $PV | awk -F 'Vendor=413c ProdID=81d7' '{print $2}' | cut -c-1520)
|
||||
|
||||
if echo "$PVCUT" | grep -q "Driver=qmi_wwan"
|
||||
then
|
||||
PROTO="qmi"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_mbim"
|
||||
then
|
||||
PROTO="mbim"
|
||||
elif echo "$PVCUT" | grep -q "Driver=cdc_ether"
|
||||
then
|
||||
PROTO="ecm"
|
||||
fi
|
||||
|
||||
# Modem
|
||||
PVMODEL=$(echo $PV | awk -F 'Vendor=413c ProdID=81d7' '{print $2}' | cut -c-150)
|
||||
if [ -z "$MODEL" ]
|
||||
then
|
||||
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}'| xargs)
|
||||
MODELACUT=$(echo $PVMODEL | awk -F 'Product=|S: SerialNumber' '{print $2}'| xargs)
|
||||
MODELC="$MODELBCUT "$MODELACUT
|
||||
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}' | tr -d '\r\n')
|
||||
fi
|
||||
|
||||
# FW
|
||||
OF=$(sms_tool -d $DEVICE at "ati")
|
||||
DEV2=$(echo $OF | tr -s "\n" | xargs)
|
||||
FW=$(echo $DEV2 | awk -F 'Revision: | IMEI: ' '{print $2}' | cut -c-50)
|
||||
|
||||
T=$(echo "$O" | awk -F ': ' '/ICCID:/ {print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
NR_ICCID="$T"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs)
|
||||
NR_I=$(echo "$O")
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O")
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+ICCID" | xargs)
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\ICCID:/{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
305
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/808707f9
Normal file
@ -0,0 +1,305 @@
|
||||
# Fibocom L860-GL
|
||||
# Thanks to https://github.com/koshev-msk
|
||||
# Modem support based on luci-app-modeminfo package
|
||||
|
||||
convertchannel() {
|
||||
if [ $1 -ge 0 ] && [ $1 -le 599 ]; then
|
||||
newband=1
|
||||
elif [ $1 -ge 600 ] && [ $1 -le 1199 ]; then
|
||||
newband=2
|
||||
elif [ $1 -ge 1200 ] && [ $1 -le 1949 ]; then
|
||||
newband=3
|
||||
elif [ $1 -ge 1950] && [ $1 -le 2399 ]; then
|
||||
newband=4
|
||||
elif [ $1 -ge 2400] && [ $1 -le 2469 ]; then
|
||||
newband=5
|
||||
elif [ $1 -ge 2750 ] && [ $1 -le 3449 ]; then
|
||||
newband=7
|
||||
elif [ $1 -ge 3450 ] && [ $1 -le 3799 ]; then
|
||||
newband=8
|
||||
elif [ $1 -ge 6150 ] && [ $1 -le 6449 ]; then
|
||||
newband=20
|
||||
elif [ $1 -ge 9210 ] && [ $1 -le 9659 ]; then
|
||||
newband=28
|
||||
elif [ $1 -ge 9870 ] && [ $1 -le 9919 ]; then
|
||||
newband=31
|
||||
elif [ $1 -ge 37750 ] && [ $1 -le 38249 ]; then
|
||||
newband=38
|
||||
elif [ $1 -ge 38650 ] && [ $1 -le 39649 ]; then
|
||||
newband=40
|
||||
else
|
||||
newband=0
|
||||
fi
|
||||
}
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+xlec?;+rsrp?;+rsrq?;+xmci=1")
|
||||
|
||||
T=$(echo "$O" | awk -F [:_] '/\+XLEC:/{gsub("\r",""); print $4}' | awk -F [:,] '{print $1}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"1"*) MODE="${MODE} "$(band 1 "");;
|
||||
*"2"*) MODE="${MODE} "$(band 2 "");;
|
||||
*"3"*) MODE="${MODE} "$(band 3 "");;
|
||||
*"4"*) MODE="${MODE} "$(band 4 "");;
|
||||
*"5"*) MODE="${MODE} "$(band 5 "");;
|
||||
*"7"*) MODE="${MODE} "$(band 7 "");;
|
||||
*"8"*) MODE="${MODE} "$(band 8 "");;
|
||||
*"12"*) MODE="${MODE} "$(band 12 "");;
|
||||
*"13"*) MODE="${MODE} "$(band 13 "");;
|
||||
*"14"*) MODE="${MODE} "$(band 14 "");;
|
||||
*"17"*) MODE="${MODE} "$(band 17 "");;
|
||||
*"18"*) MODE="${MODE} "$(band 18 "");;
|
||||
*"19"*) MODE="${MODE} "$(band 19 "");;
|
||||
*"20"*) MODE="${MODE} "$(band 20 "");;
|
||||
*"21"*) MODE="${MODE} "$(band 21 "");;
|
||||
*"25"*) MODE="${MODE} "$(band 25 "");;
|
||||
*"26"*) MODE="${MODE} "$(band 26 "");;
|
||||
*"28"*) MODE="${MODE} "$(band 28 "");;
|
||||
*"29"*) MODE="${MODE} "$(band 29 "");;
|
||||
*"30"*) MODE="${MODE} "$(band 30 "");;
|
||||
*"32"*) MODE="${MODE} "$(band 32 "");;
|
||||
*"34"*) MODE="${MODE} "$(band 34 "");;
|
||||
*"38"*) MODE="${MODE} "$(band 38 "");;
|
||||
*"39"*) MODE="${MODE} "$(band 39 "");;
|
||||
*"40"*) MODE="${MODE} "$(band 40 "");;
|
||||
*"41"*) MODE="${MODE} "$(band 41 "");;
|
||||
*"42"*) MODE="${MODE} "$(band 42 "");;
|
||||
*"43"*) MODE="${MODE} "$(band 43 "");;
|
||||
*"46"*) MODE="${MODE} "$(band 46 "");;
|
||||
*"48"*) MODE="${MODE} "$(band 48 "");;
|
||||
*"66"*) MODE="${MODE} "$(band 66 "");;
|
||||
*"71"*) MODE="${MODE} "$(band 71 "");;
|
||||
*) MODE="${MODE} ${T}";;
|
||||
esac
|
||||
fi
|
||||
|
||||
RSRP=$(echo "$O" | awk -F [:,] '/\+RSRP:/{printf "%.0f\n", $4}')
|
||||
|
||||
BWDL=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r","",$4); print $4}')
|
||||
case $BWDL in
|
||||
1) NP=15 ;;
|
||||
2) NP=25 ;;
|
||||
3) NP=50 ;;
|
||||
4) NP=75 ;;
|
||||
5) NP=100 ;;
|
||||
*) NP=0 ;;
|
||||
esac
|
||||
|
||||
CSQ=$(echo $RSRP $NP | awk '{printf "%.0f\n", (($1+10*log(12*$2)/log(10))+113)/2}')
|
||||
[ "x$CSQ" = "x" ] && CSQ=-1
|
||||
if [ $CSQ -ge 0 -a $CSQ -le 31 ]; then
|
||||
CSQ_PER=$(($CSQ * 100/31))
|
||||
RSSI=$((2 * CSQ - 113))
|
||||
# Fibocom RSSI up -51dBm. Thanks to TSA74 at 4pda.to
|
||||
elif [ $CSQ -ge 32 -a $CSQ -le 50 ]; then
|
||||
RSSI=$((2 * CSQ - 113))
|
||||
CSQ_PER="100"
|
||||
else
|
||||
CSQ_PER="0"
|
||||
fi
|
||||
|
||||
RSRQ=$(echo "$O" | awk -F [:,] '/\+RSRQ:/{printf "%.0f\n", $4}')
|
||||
SINR=$(echo "$O" | awk -F [:,] '/\+XMCI: 4/{gsub(/"/,""); printf "%.0f\n", $13/4+5}')
|
||||
|
||||
LTE_Cx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{print $3}')
|
||||
LTE_CA=$(($LTE_Cx -1))
|
||||
|
||||
if [ -n "LTE_CA" ]; then
|
||||
|
||||
case $LTE_CA in
|
||||
1*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5}')
|
||||
;;
|
||||
2*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6" "$9}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5" "$6}');;
|
||||
3*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6" "$9" "$12}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5" "$6" "$7}')
|
||||
;;
|
||||
4*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6" "$9" "$12" "$15}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5" "$6" "$7" "$8}')
|
||||
;;
|
||||
esac
|
||||
|
||||
CA_BAND=""
|
||||
for sca in $CAx; do
|
||||
convertchannel $sca 2> /dev/null
|
||||
BAND="$(band $newband "")"
|
||||
CA_BAND=$CA_BAND' / '$BAND
|
||||
CABANDx=$CABANDx','$newband
|
||||
done
|
||||
MODE="LTE-A | $(band $T "")${CA_BAND}"
|
||||
|
||||
S1=$(echo "$CABANDx" | awk -F [,] '/\,/{print $2" "}' | sed 's/ //g')
|
||||
S2=$(echo "$CABANDx" | awk -F [,] '/\,/{print $3" "}' | sed 's/ //g')
|
||||
S3=$(echo "$CABANDx" | awk -F [,] '/\,/{print $4" "}' | sed 's/ //g')
|
||||
S4=$(echo "$CABANDx" | awk -F [,] '/\,/{print $5" "}' | sed 's/ //g')
|
||||
|
||||
BWCA=0
|
||||
BWCA_INFO=""
|
||||
for T3 in $BWCx; do
|
||||
case $T3 in
|
||||
1*) T5="3";;
|
||||
2*) T5="5";;
|
||||
3*) T5="10";;
|
||||
4*) T5="15";;
|
||||
5*) T5="20";;
|
||||
*) T5="0";;
|
||||
esac
|
||||
BWCA=$(($BWCA+$T5))
|
||||
[[ -z ${BWCA_INFO} ]] && BWCA_INFO="${T5}" || BWCA_INFO="${BWCA_INFO},${T5}"
|
||||
done
|
||||
|
||||
BW1=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $2" "}')
|
||||
BW2=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $3" "}')
|
||||
BW3=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $4" "}')
|
||||
BW4=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $5" "}')
|
||||
|
||||
T2=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "}')
|
||||
case $T2 in
|
||||
1*) T4="3";;
|
||||
2*) T4="5";;
|
||||
3*) T4="10";;
|
||||
4*) T4="15";;
|
||||
5*) T4="20";;
|
||||
*) T4="0";;
|
||||
esac
|
||||
|
||||
if [ -n "$T4" ]; then
|
||||
PBAND="$(band $T "") @$T4 MHz"
|
||||
PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $2}')
|
||||
EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $3}')
|
||||
fi
|
||||
|
||||
if [ -n "$S1" ]; then
|
||||
S1BAND="$(band $S1 "") @$BW1 MHz"
|
||||
S1PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $5}')
|
||||
S1EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $6}')
|
||||
fi
|
||||
if [ -n "$S2" ]; then
|
||||
S2BAND="$(band $S2 "") @$BW2 MHz"
|
||||
S2PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $8}')
|
||||
S2EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $9}')
|
||||
fi
|
||||
if [ -n "$S3" ]; then
|
||||
S3BAND="$(band $S3 "") @$BW3 MHz"
|
||||
S3PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $11}')
|
||||
S3EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $12}')
|
||||
fi
|
||||
if [ -n "$S4" ]; then
|
||||
S4BAND="$(band $S4 "") @$BW4 MHz"
|
||||
S4PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $14}')
|
||||
S4EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $15}')
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$MODE" != *"LTE-A"* ]]; then
|
||||
if [ -n "$T" ]; then
|
||||
MODE="LTE | $(band $T "")"
|
||||
|
||||
T2=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "}')
|
||||
case $T2 in
|
||||
1*) T4="3";;
|
||||
2*) T4="5";;
|
||||
3*) T4="10";;
|
||||
4*) T4="15";;
|
||||
5*) T4="20";;
|
||||
*) T4="0";;
|
||||
esac
|
||||
|
||||
if [ -n "$T4" ]; then
|
||||
PBAND="$(band $T "") @$T4 MHz"
|
||||
PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $2}')
|
||||
EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $3}')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GTPKGVER?" | xargs)
|
||||
FW=$(echo "$FWA" | cut -d ":" -f2 | xargs)
|
||||
|
||||
MDL=$(sms_tool -d $DEVICE at "AT+GMM?" | xargs)
|
||||
MODELM=$(echo "$MDL" | cut -d ':' -f2 | cut -d ',' -f1 | awk -F'"' '{print $1}')
|
||||
MODELF=$(sms_tool -d $DEVICE at "AT+CGMI" | xargs)
|
||||
|
||||
MODELMCUT=$(echo $MODELM)
|
||||
MODELFCUT=$(echo $MODELF | sed s/"AT+CGMI "//)
|
||||
MODEL="$MODELFCUT "$MODELMCUT
|
||||
|
||||
# Temperature
|
||||
TC=$(sms_tool -d $DEVICE at "AT+MTSM=1" | xargs)
|
||||
T=$(echo "$TC" | awk -F[:,] '/\+MTSM:/{print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+CGSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+CCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCAX=$(echo $PV | awk -F"Vendor=8087 ProdID=07f9" '{print $2}')
|
||||
PVCA=$(echo "$PVCAX" | cut -c-2453)
|
||||
PVCBX=$(echo $PV | awk -F"Vendor=8087 ProdID=095a" '{print $2}')
|
||||
PVCB=$(echo "$PVCBX" | cut -c-2453)
|
||||
|
||||
if [ -n "$PVCA" ]; then
|
||||
case $PVCA in
|
||||
*"Driver=qmi_wwan"*)
|
||||
PROTO="qmi"
|
||||
;;
|
||||
*"Driver=cdc_ncm"*)
|
||||
PROTO="ncm"
|
||||
;;
|
||||
*"Driver=cdc_mbim"*)
|
||||
PROTO="mbim"
|
||||
;;
|
||||
*"Driver=cdc_ether"*)
|
||||
PROTO="ecm"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$PVCB" ]; then
|
||||
case $PVCB in
|
||||
*"Driver=qmi_wwan"*)
|
||||
PROTO="qmi"
|
||||
;;
|
||||
*"Driver=cdc_ncm"*)
|
||||
PROTO="ncm"
|
||||
;;
|
||||
*"Driver=cdc_mbim"*)
|
||||
PROTO="mbim"
|
||||
;;
|
||||
*"Driver=cdc_ether"*)
|
||||
PROTO="ecm"
|
||||
;;
|
||||
esac
|
||||
fi
|
305
luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/8087095a
Normal file
@ -0,0 +1,305 @@
|
||||
# Fibocom L860-GL
|
||||
# Thanks to https://github.com/koshev-msk
|
||||
# Modem support based on luci-app-modeminfo package
|
||||
|
||||
convertchannel() {
|
||||
if [ $1 -ge 0 ] && [ $1 -le 599 ]; then
|
||||
newband=1
|
||||
elif [ $1 -ge 600 ] && [ $1 -le 1199 ]; then
|
||||
newband=2
|
||||
elif [ $1 -ge 1200 ] && [ $1 -le 1949 ]; then
|
||||
newband=3
|
||||
elif [ $1 -ge 1950] && [ $1 -le 2399 ]; then
|
||||
newband=4
|
||||
elif [ $1 -ge 2400] && [ $1 -le 2469 ]; then
|
||||
newband=5
|
||||
elif [ $1 -ge 2750 ] && [ $1 -le 3449 ]; then
|
||||
newband=7
|
||||
elif [ $1 -ge 3450 ] && [ $1 -le 3799 ]; then
|
||||
newband=8
|
||||
elif [ $1 -ge 6150 ] && [ $1 -le 6449 ]; then
|
||||
newband=20
|
||||
elif [ $1 -ge 9210 ] && [ $1 -le 9659 ]; then
|
||||
newband=28
|
||||
elif [ $1 -ge 9870 ] && [ $1 -le 9919 ]; then
|
||||
newband=31
|
||||
elif [ $1 -ge 37750 ] && [ $1 -le 38249 ]; then
|
||||
newband=38
|
||||
elif [ $1 -ge 38650 ] && [ $1 -le 39649 ]; then
|
||||
newband=40
|
||||
else
|
||||
newband=0
|
||||
fi
|
||||
}
|
||||
|
||||
O=$(sms_tool -d $DEVICE at "at+xlec?;+rsrp?;+rsrq?;+xmci=1")
|
||||
|
||||
T=$(echo "$O" | awk -F [:_] '/\+XLEC:/{gsub("\r",""); print $4}' | awk -F [:,] '{print $1}')
|
||||
if [ -n "$T" ]; then
|
||||
case $T in
|
||||
*"1"*) MODE="${MODE} "$(band 1 "");;
|
||||
*"2"*) MODE="${MODE} "$(band 2 "");;
|
||||
*"3"*) MODE="${MODE} "$(band 3 "");;
|
||||
*"4"*) MODE="${MODE} "$(band 4 "");;
|
||||
*"5"*) MODE="${MODE} "$(band 5 "");;
|
||||
*"7"*) MODE="${MODE} "$(band 7 "");;
|
||||
*"8"*) MODE="${MODE} "$(band 8 "");;
|
||||
*"12"*) MODE="${MODE} "$(band 12 "");;
|
||||
*"13"*) MODE="${MODE} "$(band 13 "");;
|
||||
*"14"*) MODE="${MODE} "$(band 14 "");;
|
||||
*"17"*) MODE="${MODE} "$(band 17 "");;
|
||||
*"18"*) MODE="${MODE} "$(band 18 "");;
|
||||
*"19"*) MODE="${MODE} "$(band 19 "");;
|
||||
*"20"*) MODE="${MODE} "$(band 20 "");;
|
||||
*"21"*) MODE="${MODE} "$(band 21 "");;
|
||||
*"25"*) MODE="${MODE} "$(band 25 "");;
|
||||
*"26"*) MODE="${MODE} "$(band 26 "");;
|
||||
*"28"*) MODE="${MODE} "$(band 28 "");;
|
||||
*"29"*) MODE="${MODE} "$(band 29 "");;
|
||||
*"30"*) MODE="${MODE} "$(band 30 "");;
|
||||
*"32"*) MODE="${MODE} "$(band 32 "");;
|
||||
*"34"*) MODE="${MODE} "$(band 34 "");;
|
||||
*"38"*) MODE="${MODE} "$(band 38 "");;
|
||||
*"39"*) MODE="${MODE} "$(band 39 "");;
|
||||
*"40"*) MODE="${MODE} "$(band 40 "");;
|
||||
*"41"*) MODE="${MODE} "$(band 41 "");;
|
||||
*"42"*) MODE="${MODE} "$(band 42 "");;
|
||||
*"43"*) MODE="${MODE} "$(band 43 "");;
|
||||
*"46"*) MODE="${MODE} "$(band 46 "");;
|
||||
*"48"*) MODE="${MODE} "$(band 48 "");;
|
||||
*"66"*) MODE="${MODE} "$(band 66 "");;
|
||||
*"71"*) MODE="${MODE} "$(band 71 "");;
|
||||
*) MODE="${MODE} ${T}";;
|
||||
esac
|
||||
fi
|
||||
|
||||
RSRP=$(echo "$O" | awk -F [:,] '/\+RSRP:/{printf "%.0f\n", $4}')
|
||||
|
||||
BWDL=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r","",$4); print $4}')
|
||||
case $BWDL in
|
||||
1) NP=15 ;;
|
||||
2) NP=25 ;;
|
||||
3) NP=50 ;;
|
||||
4) NP=75 ;;
|
||||
5) NP=100 ;;
|
||||
*) NP=0 ;;
|
||||
esac
|
||||
|
||||
CSQ=$(echo $RSRP $NP | awk '{printf "%.0f\n", (($1+10*log(12*$2)/log(10))+113)/2}')
|
||||
[ "x$CSQ" = "x" ] && CSQ=-1
|
||||
if [ $CSQ -ge 0 -a $CSQ -le 31 ]; then
|
||||
CSQ_PER=$(($CSQ * 100/31))
|
||||
RSSI=$((2 * CSQ - 113))
|
||||
# Fibocom RSSI up -51dBm. Thanks to TSA74 at 4pda.to
|
||||
elif [ $CSQ -ge 32 -a $CSQ -le 50 ]; then
|
||||
RSSI=$((2 * CSQ - 113))
|
||||
CSQ_PER="100"
|
||||
else
|
||||
CSQ_PER="0"
|
||||
fi
|
||||
|
||||
RSRQ=$(echo "$O" | awk -F [:,] '/\+RSRQ:/{printf "%.0f\n", $4}')
|
||||
SINR=$(echo "$O" | awk -F [:,] '/\+XMCI: 4/{gsub(/"/,""); printf "%.0f\n", $13/4+5}')
|
||||
|
||||
LTE_Cx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{print $3}')
|
||||
LTE_CA=$(($LTE_Cx -1))
|
||||
|
||||
if [ -n "LTE_CA" ]; then
|
||||
|
||||
case $LTE_CA in
|
||||
1*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5}')
|
||||
;;
|
||||
2*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6" "$9}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5" "$6}');;
|
||||
3*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6" "$9" "$12}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5" "$6" "$7}')
|
||||
;;
|
||||
4*)
|
||||
CAx=$(echo "$O" | awk -F [:,] '/\+RSRP:/{print $6" "$9" "$12" "$15}')
|
||||
BWCx=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "$5" "$6" "$7" "$8}')
|
||||
;;
|
||||
esac
|
||||
|
||||
CA_BAND=""
|
||||
for sca in $CAx; do
|
||||
convertchannel $sca 2> /dev/null
|
||||
BAND="$(band $newband "")"
|
||||
CA_BAND=$CA_BAND' / '$BAND
|
||||
CABANDx=$CABANDx','$newband
|
||||
done
|
||||
MODE="LTE-A | $(band $T "")${CA_BAND}"
|
||||
|
||||
S1=$(echo "$CABANDx" | awk -F [,] '/\,/{print $2" "}' | sed 's/ //g')
|
||||
S2=$(echo "$CABANDx" | awk -F [,] '/\,/{print $3" "}' | sed 's/ //g')
|
||||
S3=$(echo "$CABANDx" | awk -F [,] '/\,/{print $4" "}' | sed 's/ //g')
|
||||
S4=$(echo "$CABANDx" | awk -F [,] '/\,/{print $5" "}' | sed 's/ //g')
|
||||
|
||||
BWCA=0
|
||||
BWCA_INFO=""
|
||||
for T3 in $BWCx; do
|
||||
case $T3 in
|
||||
1*) T5="3";;
|
||||
2*) T5="5";;
|
||||
3*) T5="10";;
|
||||
4*) T5="15";;
|
||||
5*) T5="20";;
|
||||
*) T5="0";;
|
||||
esac
|
||||
BWCA=$(($BWCA+$T5))
|
||||
[[ -z ${BWCA_INFO} ]] && BWCA_INFO="${T5}" || BWCA_INFO="${BWCA_INFO},${T5}"
|
||||
done
|
||||
|
||||
BW1=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $2" "}')
|
||||
BW2=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $3" "}')
|
||||
BW3=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $4" "}')
|
||||
BW4=$(echo "$BWCA_INFO" | awk -F [,] '/\,/{print $5" "}')
|
||||
|
||||
T2=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "}')
|
||||
case $T2 in
|
||||
1*) T4="3";;
|
||||
2*) T4="5";;
|
||||
3*) T4="10";;
|
||||
4*) T4="15";;
|
||||
5*) T4="20";;
|
||||
*) T4="0";;
|
||||
esac
|
||||
|
||||
if [ -n "$T4" ]; then
|
||||
PBAND="$(band $T "") @$T4 MHz"
|
||||
PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $2}')
|
||||
EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $3}')
|
||||
fi
|
||||
|
||||
if [ -n "$S1" ]; then
|
||||
S1BAND="$(band $S1 "") @$BW1 MHz"
|
||||
S1PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $5}')
|
||||
S1EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $6}')
|
||||
fi
|
||||
if [ -n "$S2" ]; then
|
||||
S2BAND="$(band $S2 "") @$BW2 MHz"
|
||||
S2PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $8}')
|
||||
S2EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $9}')
|
||||
fi
|
||||
if [ -n "$S3" ]; then
|
||||
S3BAND="$(band $S3 "") @$BW3 MHz"
|
||||
S3PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $11}')
|
||||
S3EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $12}')
|
||||
fi
|
||||
if [ -n "$S4" ]; then
|
||||
S4BAND="$(band $S4 "") @$BW4 MHz"
|
||||
S4PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $14}')
|
||||
S4EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $15}')
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$MODE" != *"LTE-A"* ]]; then
|
||||
if [ -n "$T" ]; then
|
||||
MODE="LTE | $(band $T "")"
|
||||
|
||||
T2=$(echo "$O" | awk -F [:,] '/\+XLEC:/{gsub("\r",""); print $4" "}')
|
||||
case $T2 in
|
||||
1*) T4="3";;
|
||||
2*) T4="5";;
|
||||
3*) T4="10";;
|
||||
4*) T4="15";;
|
||||
5*) T4="20";;
|
||||
*) T4="0";;
|
||||
esac
|
||||
|
||||
if [ -n "$T4" ]; then
|
||||
PBAND="$(band $T "") @$T4 MHz"
|
||||
PCI=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $2}')
|
||||
EARFCN=$(echo "$O" | awk -F[,:] '/^\+RSRP:/ {print $3}')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
MODE=$(echo $MODE | sed 's,/,+,')
|
||||
|
||||
# Modem
|
||||
FWA=$(sms_tool -d $DEVICE at "AT+GTPKGVER?" | xargs)
|
||||
FW=$(echo "$FWA" | cut -d ":" -f2 | xargs)
|
||||
|
||||
MDL=$(sms_tool -d $DEVICE at "AT+GMM?" | xargs)
|
||||
MODELM=$(echo "$MDL" | cut -d ':' -f2 | cut -d ',' -f1 | awk -F'"' '{print $1}')
|
||||
MODELF=$(sms_tool -d $DEVICE at "AT+CGMI" | xargs)
|
||||
|
||||
MODELMCUT=$(echo $MODELM)
|
||||
MODELFCUT=$(echo $MODELF | sed s/"AT+CGMI "//)
|
||||
MODEL="$MODELFCUT "$MODELMCUT
|
||||
|
||||
# Temperature
|
||||
TC=$(sms_tool -d $DEVICE at "AT+MTSM=1" | xargs)
|
||||
T=$(echo "$TC" | awk -F[:,] '/\+MTSM:/{print $2}')
|
||||
if [ -n "$T" ]; then
|
||||
TEMP="$T °C"
|
||||
fi
|
||||
|
||||
# International Mobile Equipment Identity (IMEI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs)
|
||||
NR_I=$(echo "$O" | sed s/"AT+CGSN "//)
|
||||
if [ -n "$NR_I" ]; then
|
||||
NR_IMEI="$NR_I"
|
||||
fi
|
||||
|
||||
# International Mobile Subscriber Identity (IMSI)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)
|
||||
NR_C=$(echo "$O" | sed s/"AT+CIMI "//)
|
||||
if [ -n "$NR_C" ]; then
|
||||
NR_IMSI="$NR_C"
|
||||
fi
|
||||
|
||||
# Integrated Circuit Card Identifier (ICCID)
|
||||
O=$(sms_tool -d $DEVICE at "AT+CCID")
|
||||
NR_D=$(echo "$O" | awk -F [:] '/^\+CCID: /{print $2}' | xargs)
|
||||
if [ -n "$NR_D" ]; then
|
||||
NR_ICCID="$NR_D"
|
||||
fi
|
||||
|
||||
# Protocol
|
||||
# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER
|
||||
PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null)
|
||||
PVCAX=$(echo $PV | awk -F"Vendor=8087 ProdID=07f9" '{print $2}')
|
||||
PVCA=$(echo "$PVCAX" | cut -c-2453)
|
||||
PVCBX=$(echo $PV | awk -F"Vendor=8087 ProdID=095a" '{print $2}')
|
||||
PVCB=$(echo "$PVCBX" | cut -c-2453)
|
||||
|
||||
if [ -n "$PVCA" ]; then
|
||||
case $PVCA in
|
||||
*"Driver=qmi_wwan"*)
|
||||
PROTO="qmi"
|
||||
;;
|
||||
*"Driver=cdc_ncm"*)
|
||||
PROTO="ncm"
|
||||
;;
|
||||
*"Driver=cdc_mbim"*)
|
||||
PROTO="mbim"
|
||||
;;
|
||||
*"Driver=cdc_ether"*)
|
||||
PROTO="ecm"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "$PVCB" ]; then
|
||||
case $PVCB in
|
||||
*"Driver=qmi_wwan"*)
|
||||
PROTO="qmi"
|
||||
;;
|
||||
*"Driver=cdc_ncm"*)
|
||||
PROTO="ncm"
|
||||
;;
|
||||
*"Driver=cdc_mbim"*)
|
||||
PROTO="mbim"
|
||||
;;
|
||||
*"Driver=cdc_ether"*)
|
||||
PROTO="ecm"
|
||||
;;
|
||||
esac
|
||||
fi
|
@ -0,0 +1,59 @@
|
||||
{
|
||||
"admin/modem": {
|
||||
"title": "Modem",
|
||||
"order": 30,
|
||||
"action": {
|
||||
"type": "firstchild",
|
||||
"recurse": true
|
||||
}
|
||||
},
|
||||
|
||||
"admin/modem/3ginfo-lite": {
|
||||
"title": "Information about 3G/4G/5G modems",
|
||||
"order": 10,
|
||||
"action": {
|
||||
"type": "alias",
|
||||
"path": "admin/modem/3ginfo-lite/3gdetail"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-3ginfo-lite" ],
|
||||
"uci": { "3ginfo": true }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/modem/3ginfo-lite/3gdetail": {
|
||||
"title": "Modem1 Details",
|
||||
"order": 10,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "modem/3gdetail"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/modem/3ginfo-lite/3gdetail1": {
|
||||
"title": "Modem2 Details",
|
||||
"order": 11,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "modem/3gdetail1"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/modem/3ginfo-lite/atcommand": {
|
||||
"title": "AT command",
|
||||
"order": 20,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "modem/atcommand"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/modem/3ginfo-lite/3gconfig": {
|
||||
"title": "Configuration",
|
||||
"order": 30,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "modem/3gconfig"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
{
|
||||
"luci-app-3ginfo-lite": {
|
||||
"description": "Grant access to LuCI app 3ginfo-lite",
|
||||
"read": {
|
||||
"cgi-io": [ "exec" ],
|
||||
"file": {
|
||||
"/usr/bin/sms_tool": [ "exec" ],
|
||||
"/usr/share/3ginfo-lite/3ginfo.sh": [ "exec" ],
|
||||
"/usr/share/3ginfo-lite/detect.sh": [ "exec" ],
|
||||
"/usr/share/3ginfo-lite/check.gcom": [ "exec" ],
|
||||
"/usr/share/3ginfo-lite/info.gcom": [ "exec" ],
|
||||
"/etc/modemdefine": [ "read" ],
|
||||
"/etc/3ginfo": [ "read" ],
|
||||
"/sys/kernel/debug/usb/devices": [ "read" ]
|
||||
},
|
||||
"uci": [ "3ginfo", "modemdefine" ]
|
||||
},
|
||||
"write": {
|
||||
"file": {
|
||||
"/bin/cat": [ "exec" ],
|
||||
"/etc/modemdefine": [ "write" ],
|
||||
"/etc/3ginfo": [ "write" ]
|
||||
},
|
||||
"uci": [ "3ginfo", "modemdefine" ]
|
||||
}
|
||||
}
|
||||
}
|
87
luci-app-fakemesh/Makefile
Normal file
@ -0,0 +1,87 @@
|
||||
#
|
||||
# Copyright (C) 2017-2019 Chen Minqiang <ptpt52@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-fakemesh
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Chen Minqiang <ptpt52@gmail.com>
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-fakemesh
|
||||
CATEGORY:=X
|
||||
SUBMENU:=Configuration Fake Mesh Support
|
||||
TITLE:=LuCI Support for fakemesh
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+jsonfilter +umdns +firewall4
|
||||
endef
|
||||
|
||||
define Package/luci-app-fakemesh/description
|
||||
LuCI Support for fakemsh.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
|
||||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/luci-app-fakemesh/conffiles
|
||||
/etc/config/fakemesh
|
||||
endef
|
||||
|
||||
define Package/luci-app-fakemesh/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$$IPKG_INSTROOT" ]; then
|
||||
( . /etc/uci-defaults/40_luci-app-fakemesh )
|
||||
rm -f /etc/uci-defaults/40_luci-app-fakemesh
|
||||
( . /etc/uci-defaults/96-fakemesh-defaults )
|
||||
rm -f /etc/uci-defaults/96-fakemesh-defaults
|
||||
|
||||
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
|
||||
fi
|
||||
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/luci-app-fakemesh/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/fakemesh.*.lmo $(1)/usr/lib/lua/luci/i18n/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./root/etc/config/fakemesh $(1)/etc/config/fakemesh
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./root/etc/init.d/fakemesh $(1)/etc/init.d/fakemesh
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./root/usr/sbin/fakemesh $(1)/usr/sbin/fakemesh
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DATA) ./root/etc/uci-defaults/40_luci-app-fakemesh $(1)/etc/uci-defaults/40_luci-app-fakemesh
|
||||
$(INSTALL_DATA) ./root/etc/uci-defaults/96-fakemesh-defaults $(1)/etc/uci-defaults/96-fakemesh-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp/
|
||||
$(INSTALL_DATA) ./root/etc/hotplug.d/dhcp/10-fakemesh $(1)/etc/hotplug.d/dhcp/10-fakemesh
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface/
|
||||
$(INSTALL_DATA) ./root/etc/hotplug.d/iface/19-fakemesh $(1)/etc/hotplug.d/iface/19-fakemesh
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/
|
||||
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
|
||||
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/*.json $(1)/usr/share/luci/menu.d/
|
||||
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/fakemesh
|
||||
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/fakemesh/fakemesh.js $(1)/www/luci-static/resources/view/fakemesh/fakemesh.js
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-fakemesh))
|
86
luci-app-fakemesh/README.md
Normal file
@ -0,0 +1,86 @@
|
||||
## fakemesh简介
|
||||
|
||||
fakemesh是一种网络拓扑结构,由一个`控制器(AC)`和一个或多个`有线AP(Wired AP)`和`卫星(Agent)`组成。它是一种混合了`无线Mesh`和`AC+AP`两种组网模式的混合网络,其中,`有线AP`通过网线和`控制器(AC)`相连,而`卫星(Agent)`则通过无线STA方式接入,共同构成一个无线(包括有线)覆盖网络。
|
||||
|
||||
fakemesh的部署确实相对较为方便,只需要将节点设备连接到正确的网络,并设置节点设备的角色,Mesh ID等信息即可。因为fakemesh结合了无线Mesh和AC+AP两种组网模式,所以也可以很方便地进行混合组网,提高了网络的覆盖范围和可靠性。
|
||||
|
||||
目前[X-WRT](https://github.com/x-wrt/x-wrt)默认集成了fakemesh功能
|
||||
|
||||
## fakemesh 使用
|
||||
|
||||
### 组网成功后统一的访问设备的地址格式如下:
|
||||
|
||||
访问控制器的地址: `http://controller.fakemesh/`或者`http://ac.fakemesh/`
|
||||
|
||||
访问AP的地址: `http://{mac}.ap.fakemesh/` 或者 `http://N.ap.fakemesh/`
|
||||
|
||||
其中`{mac}`是AP的MAC地址,比如`{mac}=1122334455AB`,`N`是AP的自动编号,比如 N=1, N=2, N=3, ...
|
||||
|
||||
例子:
|
||||
```
|
||||
http://1.ap.fakemesh/
|
||||
http://1122334455AB.ap.fakemesh/
|
||||
```
|
||||
|
||||
### 故障处理:
|
||||
|
||||
AP离线3分钟左右进入故障模式,这个模式开启默认SSID,可以提供接入管理重新配置。
|
||||
故障模式的默认SSID和密码是:
|
||||
```
|
||||
SSID: X-WRT_XXXX
|
||||
PASSWD: 88888888
|
||||
```
|
||||
|
||||
故障模式下AP的管理IP地址是DHCP的网关地址,比如电脑获取到`192.168.16.x`的IP,那么AP的管理IP就是`192.168.16.1`
|
||||
|
||||
## fakemesh 基本组成
|
||||
|
||||
组网由一个`控制器(controller)`和一个或者多个`AP`组成
|
||||
|
||||
AP包括: `卫星(Agent)`和`有线AP(Wired AP)`两种
|
||||
|
||||
**控制器(Controller)**: 作为AC和出口路由器,提供网络出口上网,统一管理下挂的卫星和有线AP,统一管理无线
|
||||
|
||||
**卫星(Agent)**: 通过Wi-Fi组网接入的AP
|
||||
|
||||
**有线AP(Wired AP)**: 通过网线组网接入的AP
|
||||
|
||||
## fakemesh 配置参数
|
||||
|
||||
### 1. Mesh ID
|
||||
|
||||
这个参数是fakemesh网络组网的统一ID,控制器、卫星、有线AP都要设置相同的Mesh ID。
|
||||
|
||||
### 2. 密钥(Key)
|
||||
|
||||
这是组网的统一密钥,组网加密需要,如果不需要加密可以留空白。
|
||||
|
||||
### 3. 带宽(Band)
|
||||
|
||||
这是组网使用的无线频段,要设置相同,5G或者2G。
|
||||
|
||||
### 4. 角色(Role)
|
||||
|
||||
可以是控制器、卫星、有线AP。
|
||||
|
||||
### 5. 同步配置(Sync Config)
|
||||
|
||||
是否统一管理Wi-Fi配置等,Wi-Fi配置由控制器统一配置管理。
|
||||
|
||||
### 6. 访问 IP 地址(Access IP address)
|
||||
|
||||
设置一个特定的IP地址给控制器,可以通过这个IP访问控制器的管理界面。
|
||||
|
||||
### 7. 关闭前传(Fronthaul Disabled)
|
||||
这个节点关闭前传无线信号,也就是不允许其他AP节点通过这个节点Wi-Fi接入。
|
||||
|
||||
### 8. 漫游组件(Band Steer Helper)
|
||||
目前可以选择[DAWN](https://github.com/fakemesh/dawn)或者[usteer](https://github.com/fakemesh/usteer)作为漫游辅助控件。
|
||||
|
||||
## 无线管理(Wireless Management)
|
||||
|
||||
可以在控制器界面上统一管理无线,包括增删SSID,设置SSID的加密方式,频宽。
|
||||
|
||||
## 控制器(Controller)旁路部署
|
||||
|
||||
需要注意的是,如果控制器不作为网关出口并且不提供DHCP服务,用户需要手动配置网络设置,包括设置控制器的LAN口IP地址、网关IP和DNS。此外,通常控制器的LAN口会默认启用DHCP客户端,从第三方网关获取IP和网关,如果需要使用静态IP,则需要保证控制器和第三方网关在同一个网段且可以相互通信。否则,就无法实现控制器与其他AP的同步配置。
|
53
luci-app-fakemesh/files/luci/i18n/fakemesh.zh-cn.po
Normal file
@ -0,0 +1,53 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "Fake Mesh Setup"
|
||||
msgstr "假Mesh设置"
|
||||
|
||||
msgid "Fake Mesh"
|
||||
msgstr "假Mesh"
|
||||
|
||||
msgid "Role"
|
||||
msgstr "角色"
|
||||
|
||||
msgid "Leave empty if encryption is not required."
|
||||
msgstr "不需要加密请留空白。"
|
||||
|
||||
msgid "Set the gateway router as controller, others as agent."
|
||||
msgstr "把网关路由器设置成控制器,其他设置成卫星。"
|
||||
|
||||
msgid "Wired AP (ethernet as backhaul)"
|
||||
msgstr "有线AP(有线回程)"
|
||||
|
||||
msgid "Agent (wifi as backhaul)"
|
||||
msgstr "卫星(无线回程)"
|
||||
|
||||
msgid "Controller (AC)"
|
||||
msgstr "控制器 (AC)"
|
||||
|
||||
msgid "The simple ip address to access the controller."
|
||||
msgstr "访问控制器的简单ip地址。"
|
||||
|
||||
msgid "Access IP address"
|
||||
msgstr "访问 IP 地址"
|
||||
|
||||
msgid "Sync Config"
|
||||
msgstr "同步配置"
|
||||
|
||||
msgid "Sync config from the Controller."
|
||||
msgstr "从AC控制器同步配置。"
|
||||
|
||||
msgid "Wireless Management"
|
||||
msgstr "无线管理"
|
||||
|
||||
msgid "Not available on AP"
|
||||
msgstr "在AP上不可用"
|
||||
|
||||
msgid "Band Steer Helper"
|
||||
msgstr "漫游组件"
|
||||
|
||||
msgid "Fronthaul Disabled"
|
||||
msgstr "关闭前传"
|
||||
|
||||
msgid "Disable fronthaul Wi-Fi signal on this node."
|
||||
msgstr "这个节点关闭前传无线信号。"
|
@ -0,0 +1,127 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require dom';
|
||||
'require poll';
|
||||
'require uci';
|
||||
'require rpc';
|
||||
'require form';
|
||||
'require network';
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
uci.changes(),
|
||||
uci.load('fakemesh'),
|
||||
uci.load('fakemeshac')
|
||||
]);
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
|
||||
var m, s, o;
|
||||
|
||||
m = new form.Map('fakemesh', [_('Fake Mesh Setup')],
|
||||
_('Basic settings for your fake mesh overlay network'));
|
||||
|
||||
s = m.section(form.NamedSection, 'default', 'fakemesh');
|
||||
s.addremove = false;
|
||||
|
||||
o = s.option(form.Flag, 'enabled', _('Enable'));
|
||||
o.enabled = '1';
|
||||
o.disabled = '0';
|
||||
o.default = o.disabled;
|
||||
|
||||
o = s.option(form.Value, 'id', _('Mesh ID'));
|
||||
o.datatype = 'maxlength(32)';
|
||||
|
||||
o = s.option(form.Value, 'key', _('Key'), _('Leave empty if encryption is not required.'));
|
||||
o.rmempty = true;
|
||||
o.password = true;
|
||||
o.datatype = 'wpakey';
|
||||
|
||||
o = s.option(form.ListValue, 'band', _('Band'));
|
||||
o.value('5g', _('5G'));
|
||||
o.value('2g', _('2G'));
|
||||
o.default = '5g';
|
||||
|
||||
o = s.option(form.ListValue, 'role', _('Role'), _('Set the gateway router as controller, others as agent.'));
|
||||
o.value('wap', _('Wired AP (ethernet as backhaul)'));
|
||||
o.value('agent', _('Agent (wifi as backhaul)'));
|
||||
o.value('controller', _('Controller (AC)'));
|
||||
o.default = 'agent';
|
||||
|
||||
o = s.option(form.Value, 'access_ip', _('Access IP address'), _('The simple ip address to access the controller.'));
|
||||
o.depends('role', 'controller');
|
||||
o.placeholder = '10.10.10.1'
|
||||
o.rmempty = true;
|
||||
o.datatype = 'ip4addr';
|
||||
|
||||
o = s.option(form.Flag, 'sync_ac', _('Sync Config'), _('Sync config from the Controller.'));
|
||||
o.enabled = '1';
|
||||
o.disabled = '0';
|
||||
o.default = o.enabled;
|
||||
|
||||
o = s.option(form.ListValue, 'band_steer_helper', _('Band Steer Helper'));
|
||||
o.value('usteer', _('usteer'));
|
||||
o.value('dawn', _('DAWN'));
|
||||
o.default = 'usteer';
|
||||
|
||||
o = s.option(form.Flag, 'fronthaul_disabled', _('Fronthaul Disabled'), _('Disable fronthaul Wi-Fi signal on this node.'));
|
||||
o.enabled = '1';
|
||||
o.disabled = '0';
|
||||
o.default = o.disabled;
|
||||
|
||||
var current_role = uci.get('fakemesh', 'default', 'role');
|
||||
|
||||
s = m.section(form.GridSection, 'wifim', _('Wireless Management'), current_role != 'controller' ? _('Not available on AP') : '');
|
||||
s.addremove = true;
|
||||
s.anonymous = true;
|
||||
s.nodescriptions = true;
|
||||
s.sortable = false;
|
||||
if (current_role != 'controller') {
|
||||
s.addremove = false;
|
||||
s.uciconfig = 'fakemeshac';
|
||||
s.renderRowActions = function (section_id) {
|
||||
return E('td', { 'class': 'td middle cbi-section-actions' }, E('div', ''));
|
||||
};
|
||||
}
|
||||
|
||||
o = s.option(form.Value, 'ssid', _('<abbr title="Extended Service Set Identifier">ESSID</abbr>'));
|
||||
o.datatype = 'maxlength(32)';
|
||||
o.rmempty = false;
|
||||
if (current_role != 'controller') o.readonly = true;
|
||||
|
||||
o = s.option(form.ListValue, 'encryption', _('Encryption'));
|
||||
o.value('none', _('No Encryption'));
|
||||
o.value('psk', _('WPA-PSK'));
|
||||
o.value('psk2', _('WPA2-PSK'));
|
||||
o.value('psk-mixed', _('WPA-PSK/WPA2-PSK Mixed Mode'));
|
||||
o.value('sae', _('WPA3-SAE'));
|
||||
o.value('sae-mixed', _('WPA2-PSK/WPA3-SAE Mixed Mode'));
|
||||
if (current_role != 'controller') o.readonly = true;
|
||||
|
||||
o = s.option(form.Value, 'key', _('Key'));
|
||||
o.depends('encryption', 'psk');
|
||||
o.depends('encryption', 'psk2');
|
||||
o.depends('encryption', 'psk-mixed');
|
||||
o.depends('encryption', 'sae');
|
||||
o.depends('encryption', 'sae-mixed');
|
||||
o.rmempty = false;
|
||||
o.password = true;
|
||||
o.datatype = 'wpakey';
|
||||
if (current_role != 'controller') o.readonly = true;
|
||||
|
||||
o = s.option(form.ListValue, 'band', _('Band'));
|
||||
o.value('2g5g', _('2G+5G'));
|
||||
o.value('5g', _('5G'));
|
||||
o.value('2g', _('2G'));
|
||||
o.default = '2g5g';
|
||||
if (current_role != 'controller') o.readonly = true;
|
||||
|
||||
o = s.option(form.Flag, 'enabled', _('Enable'));
|
||||
o.default = o.enabled;
|
||||
if (current_role != 'controller') o.readonly = true;
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
8
luci-app-fakemesh/root/etc/config/fakemesh
Normal file
@ -0,0 +1,8 @@
|
||||
config fakemesh 'default'
|
||||
option enabled '0'
|
||||
option id 'mesh-x-wrt-id'
|
||||
option key '88888888'
|
||||
option band '5g'
|
||||
option role 'agent' # agent/controller
|
||||
option band_steer_helper 'usteer' # usteer/dawn
|
||||
option fronthaul_disabled '0'
|
38
luci-app-fakemesh/root/etc/hotplug.d/dhcp/10-fakemesh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "${HOSTNAME##MESH-AGENT_*}" ] || exit 0
|
||||
[ -z "${HOSTNAME##MESH-AGENT_}" ] && exit 0
|
||||
|
||||
need_reload=0
|
||||
|
||||
case "$ACTION" in
|
||||
add | update)
|
||||
if grep -q ".* ${HOSTNAME##MESH-AGENT_}.ap.fakemesh" /tmp/hosts/fakemesh; then
|
||||
sed -i "s/.* ${HOSTNAME##MESH-AGENT_}.ap.fakemesh/$IPADDR ${HOSTNAME##MESH-AGENT_}.ap.fakemesh/" /tmp/hosts/fakemesh
|
||||
else
|
||||
echo $IPADDR ${HOSTNAME##MESH-AGENT_}.ap.fakemesh >>/tmp/hosts/fakemesh
|
||||
need_reload=1
|
||||
fi
|
||||
logger -t fakemesh "dhcp add host: $IPADDR ${HOSTNAME##MESH-AGENT_}.ap.fakemesh"
|
||||
|
||||
if ! grep -q "$IPADDR .* # ${HOSTNAME##MESH-AGENT_}.ap.fakemesh" /tmp/hosts/fakemesh.idx; then
|
||||
need_reload=1
|
||||
fi
|
||||
;;
|
||||
remove)
|
||||
sed -i "/.* ${HOSTNAME##MESH-AGENT_}.ap.fakemesh/d" /tmp/hosts/fakemesh
|
||||
need_reload=1
|
||||
logger -t fakemesh "dhcp remove host: $IPADDR ${HOSTNAME##MESH-AGENT_}.ap.fakemesh"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$need_reload" = "1" ] || [ "$(cat /tmp/hosts/fakemesh.idx | wc -l)" != "$(cat /tmp/hosts/fakemesh | wc -l)" ]; then
|
||||
echo -n >/tmp/hosts/fakemesh.idx
|
||||
idx=1
|
||||
cat /tmp/hosts/fakemesh | while read ip h; do
|
||||
echo $h $ip
|
||||
done | sort | while read h ip; do
|
||||
echo "$ip $((idx++)).ap.fakemesh # $h" >>/tmp/hosts/fakemesh.idx
|
||||
done
|
||||
#/etc/init.d/dnsmasq reload &
|
||||
fi
|
89
luci-app-fakemesh/root/etc/hotplug.d/iface/19-fakemesh
Normal file
@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
|
||||
|
||||
interface=lan
|
||||
|
||||
enabled="$(uci get fakemesh.default.enabled)"
|
||||
role="$(uci get fakemesh.default.role)"
|
||||
|
||||
[ "$enabled" = "1" ] && [ "$role" != "controller" ] && interface=meshx0
|
||||
|
||||
[ "$INTERFACE" = "$interface" ] || exit 0
|
||||
|
||||
#change hostname if mesh enabled
|
||||
if [ "$enabled" = "1" ]; then
|
||||
old_hostname="$(uci get system.@system[0].hostname || echo X-WRT)"
|
||||
new_hostname="$(uci get network.meshx0.hostname || echo $old_hostname)"
|
||||
[ "$old_hostname" != "$new_hostname" ] && {
|
||||
uci set system.@system[0].hostname="$new_hostname"
|
||||
uci commit system
|
||||
/etc/init.d/system reload
|
||||
/etc/init.d/umdns running && /etc/init.d/umdns restart
|
||||
}
|
||||
fi
|
||||
band_steer_helper=$(uci get fakemesh.default.band_steer_helper || echo usteer)
|
||||
band_steer_helper="$band_steer_helper" /usr/sbin/fakemesh band_steer_helper_switch
|
||||
|
||||
/etc/init.d/umdns enabled && {
|
||||
|
||||
[ "$interface" = "meshx0" ] && uci get umdns.@umdns[0] && {
|
||||
old_net=$(uci get umdns.@umdns[0].network)
|
||||
new_net=$(for net in $old_net meshx0; do echo $net; done | sort | uniq)
|
||||
new_net=$(echo $new_net)
|
||||
#FIXME: since umdns bug, this just an workaroud only
|
||||
new_net="meshx0"
|
||||
|
||||
[ "$old_net" != "$new_net" ] && {
|
||||
uci delete umdns.@umdns[0].network >/dev/null 2>&1
|
||||
for net in $new_net; do
|
||||
uci add_list umdns.@umdns[0].network="$net"
|
||||
done
|
||||
uci commit umdns
|
||||
/etc/init.d/umdns reload
|
||||
}
|
||||
(sleep 60 && /etc/init.d/umdns reload) &
|
||||
}
|
||||
[ "$interface" = "lan" ] && uci get umdns.@umdns[0] && {
|
||||
old_net=$(uci get umdns.@umdns[0].network)
|
||||
new_net=$(for net in $old_net lan; do [ "$net" = "meshx0" ] || echo $net; done | sort | uniq)
|
||||
new_net=$(echo $new_net)
|
||||
[ "$old_net" != "$new_net" ] && {
|
||||
uci delete umdns.@umdns[0].network >/dev/null 2>&1
|
||||
for net in $new_net; do
|
||||
uci add_list umdns.@umdns[0].network="$net"
|
||||
done
|
||||
uci commit umdns
|
||||
/etc/init.d/umdns reload
|
||||
}
|
||||
(sleep 60 && /etc/init.d/umdns reload) &
|
||||
}
|
||||
|
||||
} ##/etc/init.d/umdns enabled
|
||||
|
||||
uci get usteer.@usteer[0] && {
|
||||
old_net=$(uci get usteer.@usteer[0].network)
|
||||
new_net="$interface"
|
||||
[ "$old_net" != "$new_net" ] && {
|
||||
uci set usteer.@usteer[0].network="$new_net"
|
||||
uci commit usteer
|
||||
[ "$band_steer_helper" = "usteer" ] && /etc/init.d/usteer restart
|
||||
}
|
||||
}
|
||||
|
||||
status="$(ubus -S call network.interface.$INTERFACE status)"
|
||||
[ -n "$status" ] && {
|
||||
address=$(echo "$status" | jsonfilter -e '@["ipv4-address"][0].address')
|
||||
mask=$(echo "$status" | jsonfilter -e '@["ipv4-address"][0].mask')
|
||||
test -n "$address" && test -n "$mask" && {
|
||||
broadcast="$(ipcalc.sh "$address/$mask" | grep BROADCAST | cut -d= -f2)"
|
||||
uci get dawn.@network[0] && {
|
||||
old_broadcast="$(uci get dawn.@network[0].broadcast_ip)"
|
||||
[ "$broadcast" = "$old_broadcast" ] || {
|
||||
uci set dawn.@network[0].broadcast_ip="$broadcast"
|
||||
uci commit dawn
|
||||
[ "$band_steer_helper" = "dawn" ] && /etc/init.d/dawn reload
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
luci-app-fakemesh/root/etc/init.d/fakemesh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
boot() {
|
||||
XBOOT=1 start
|
||||
}
|
||||
|
||||
start() {
|
||||
touch /tmp/fakemesh.ac.config
|
||||
ln -s /tmp/fakemesh.ac.config /etc/config/fakemeshac 2>/dev/null
|
||||
|
||||
band_steer_helper=$(uci get fakemesh.default.band_steer_helper || echo usteer) exec /usr/sbin/fakemesh band_steer_helper_switch &
|
||||
/usr/sbin/fakemesh
|
||||
}
|
||||
|
||||
restart() {
|
||||
XRELOAD=1 start
|
||||
}
|
12
luci-app-fakemesh/root/etc/uci-defaults/40_luci-app-fakemesh
Normal file
@ -0,0 +1,12 @@
|
||||
touch /etc/config/fakemesh
|
||||
touch /etc/config/wireless
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@fakemesh[-1]
|
||||
add ucitrack fakemesh
|
||||
set ucitrack.@fakemesh[-1].init=fakemesh
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
24
luci-app-fakemesh/root/etc/uci-defaults/96-fakemesh-defaults
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
ssid=$(uci get base_config.@status[0].SSID)
|
||||
ssid_passwd=$(uci get base_config.@status[0].SSID_PASSWD)
|
||||
|
||||
uci get fakemesh.default.init || {
|
||||
uci add fakemesh wifim
|
||||
uci set fakemesh.@wifim[0].ssid="${ssid}"
|
||||
uci set fakemesh.@wifim[0].encryption='psk2'
|
||||
uci set fakemesh.@wifim[0].key="${ssid_passwd}"
|
||||
uci set fakemesh.@wifim[0].band='2g5g'
|
||||
|
||||
uci set fakemesh.default.init=1
|
||||
uci commit fakemesh
|
||||
}
|
||||
|
||||
#update cfg_version if new config need to apply
|
||||
cfg_version=1
|
||||
|
||||
[ "$(uci get fakemesh.@wifim[0].cfg_version || echo 0)" = "$cfg_version" ] || {
|
||||
uci set fakemesh.@wifim[0].cfg_version="$cfg_version"
|
||||
uci commit fakemesh
|
||||
}
|
||||
|
||||
exit 0
|
873
luci-app-fakemesh/root/usr/sbin/fakemesh
Normal file
@ -0,0 +1,873 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
band_steer_helper=${band_steer_helper:-usteer}
|
||||
|
||||
band_steer_helper_switch()
|
||||
{
|
||||
if [ "$band_steer_helper" = "usteer" ]; then
|
||||
uci delete usteer.@usteer[0].event_log_types 2>/dev/null
|
||||
uci delete usteer.@usteer[0].ssid_list 2>/dev/null
|
||||
uci commit usteer
|
||||
test -x /etc/init.d/dawn && {
|
||||
/etc/init.d/dawn enabled && /etc/init.d/dawn disable
|
||||
/etc/init.d/dawn running && /etc/init.d/dawn stop
|
||||
}
|
||||
test -x /etc/init.d/usteer && {
|
||||
/etc/init.d/usteer enabled || /etc/init.d/usteer enable
|
||||
/etc/init.d/usteer running || /etc/init.d/usteer start
|
||||
}
|
||||
else
|
||||
test -x /etc/init.d/usteer && {
|
||||
/etc/init.d/usteer enabled && /etc/init.d/usteer disable
|
||||
/etc/init.d/usteer running && /etc/init.d/usteer stop
|
||||
}
|
||||
test -x /etc/init.d/dawn && {
|
||||
/etc/init.d/dawn enabled || /etc/init.d/dawn enable
|
||||
/etc/init.d/dawn running || /etc/init.d/dawn start
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
[ "x$1" = "xband_steer_helper_switch" ] && {
|
||||
band_steer_helper_switch
|
||||
exit 0
|
||||
}
|
||||
|
||||
config_load fakemesh
|
||||
|
||||
config_get_bool enabled default 'enabled' '0'
|
||||
|
||||
test $enabled -eq 0 && {
|
||||
rm -f /www/fakemesh.*
|
||||
rm -rf /tmp/fakemesh_lck*
|
||||
rm -f /tmp/fakemesh.firewall.include
|
||||
|
||||
test -e /etc/init.d/umdns && {
|
||||
rm /tmp/fakemesh.umdns.json 2>/dev/null && \
|
||||
/etc/init.d/umdns restart
|
||||
}
|
||||
|
||||
uci delete wireless.meshx0 &>/dev/null
|
||||
uci delete wireless.meshx1 &>/dev/null
|
||||
|
||||
I=0
|
||||
while uci get wireless.@wifi-iface[$I] &>/dev/null; do
|
||||
echo "$(uci get wireless.@wifi-iface[$I].network)" | grep -q "^meshx" && {
|
||||
uci set wireless.@wifi-iface[$I].network="lan"
|
||||
}
|
||||
I=$((I+1))
|
||||
done
|
||||
|
||||
uci delete fakemesh.default.wifim_md5 &>/dev/null
|
||||
uci delete dhcp.meshx0 &>/dev/null
|
||||
uci delete network.meshx0 &>/dev/null
|
||||
uci delete network.meshx0_6 &>/dev/null
|
||||
uci delete firewall.fakemesh &>/dev/null
|
||||
sed -i "/.* controller.fakemesh/d" /etc/hosts
|
||||
sed -i "/sh \/usr\/share\/fakemesh\/firewall.include.*/d" /etc/firewall.include
|
||||
|
||||
#re-enable lan
|
||||
uci delete network.lan.auto &>/dev/null
|
||||
#re-enable wan
|
||||
uci delete network.wan.auto &>/dev/null
|
||||
uci delete network.wan6.auto &>/dev/null
|
||||
#del wan port from br-lan
|
||||
lan_idx=0
|
||||
while uci get network.@device[$lan_idx] &>/dev/null && [ $(uci get network.@device[$lan_idx].name) != "br-lan" ]; do lan_idx=$((lan_idx+1)); done
|
||||
lan_ports="$(uci get network.@device[$lan_idx].ports 2>/dev/null)"
|
||||
wan_port="$(uci get network.wan.device 2>/dev/null)"
|
||||
newlan_ports=$(for lp in $lan_ports; do [ "$lp" = "$wan_port" ] || echo $lp; done | sort | uniq)
|
||||
newlan_ports=$(echo $newlan_ports)
|
||||
[ "$lan_ports" != "$newlan_ports" ] && {
|
||||
uci delete network.@device[$lan_idx].ports &>/dev/null
|
||||
for lp in $newlan_ports; do
|
||||
uci add_list network.@device[$lan_idx].ports="$lp"
|
||||
done
|
||||
}
|
||||
|
||||
#delete meshx0 from lan zone
|
||||
lan_idx=0
|
||||
while uci get firewall.@zone[$lan_idx] &>/dev/null && [ $(uci get firewall.@zone[$lan_idx].name) != "lan" ]; do lan_idx=$((lan_idx+1)); done
|
||||
lan_net="$(uci get firewall.@zone[$lan_idx].network 2>/dev/null)"
|
||||
newlan_net=$(for ln in $lan_net; do [ "$ln" = "meshx0" -o "$ln" = "meshx0_6" ] || echo $ln; done | sort | uniq)
|
||||
newlan_net=$(echo $newlan_net)
|
||||
[ "$lan_net" != "$newlan_net" ] && {
|
||||
uci delete firewall.@zone[$lan_idx].network &>/dev/null
|
||||
for ln in $newlan_net; do
|
||||
uci add_list firewall.@zone[$lan_idx].network="$ln"
|
||||
done
|
||||
uci commit firewall
|
||||
}
|
||||
|
||||
uci changes
|
||||
|
||||
uci commit fakemesh
|
||||
uci commit wireless
|
||||
uci commit dhcp
|
||||
uci commit firewall
|
||||
uci commit network
|
||||
/etc/init.d/network reload
|
||||
/etc/init.d/dnsmasq reload
|
||||
/etc/init.d/firewall reload &>/dev/null
|
||||
exit 0
|
||||
}
|
||||
|
||||
config_get role default 'role' 'agent'
|
||||
config_get band default 'band' '5g'
|
||||
config_get Xid default 'id'
|
||||
config_get Xkey default 'key'
|
||||
config_get access_ip default 'access_ip' '10.10.10.1'
|
||||
config_get sync_ac default 'sync_ac' '1'
|
||||
config_get fronthaul_disabled default 'fronthaul_disabled' '0'
|
||||
|
||||
lost_ac=${lost_ac:-0}
|
||||
LOST_AC_CNT=3
|
||||
|
||||
agent_lost_ac()
|
||||
{
|
||||
[ "$role" = "agent" ] || [ "$role" = "wap" ] || return 0
|
||||
|
||||
pid=$$
|
||||
logger -t fakemesh "agent_lost_ac($pid): started! lost_ac=$lost_ac"
|
||||
|
||||
if test $lost_ac -gt $LOST_AC_CNT; then
|
||||
rm -rf /tmp/fakemesh_lck3
|
||||
lost_ac=$lost_ac exec /usr/sbin/fakemesh agent_sync_config &
|
||||
return 0
|
||||
fi
|
||||
|
||||
#re-enable lan
|
||||
uci delete network.lan.auto &>/dev/null
|
||||
uci set network.lan.ipaddr="192.168.16.1"
|
||||
for lip in `seq 16 20`; do
|
||||
if ip route | grep -q "192.168.$lip.0/"; then
|
||||
:
|
||||
else
|
||||
uci set network.lan.ipaddr="192.168.$lip.1"
|
||||
break
|
||||
fi
|
||||
done
|
||||
uci set network.lan.netmask='255.255.255.0'
|
||||
logger -t fakemesh "agent_lost_ac($pid): setup temporary lan ip=$(uci get network.lan.ipaddr)"
|
||||
|
||||
#re-enable lan enable wifi
|
||||
ssid=$(uci get base_config.@status[0].SSID)
|
||||
ssid_passwd=$(uci get base_config.@status[0].SSID_PASSWD)
|
||||
K=0
|
||||
for band in 2g 5g; do
|
||||
wbandstr=$(uci show wireless | grep .band=\'${band}\'$ -m1)
|
||||
if test -n "$wbandstr"; then
|
||||
radio=$(echo $wbandstr | cut -d\. -f2)
|
||||
|
||||
uci set wireless.wifinet$K=wifi-iface
|
||||
uci set wireless.wifinet$K.device="${radio}"
|
||||
uci set wireless.wifinet$K.network='lan'
|
||||
uci set wireless.wifinet$K.mode='ap'
|
||||
uci set wireless.wifinet$K.ssid="${ssid}"
|
||||
uci set wireless.wifinet$K.encryption="psk2"
|
||||
uci set wireless.wifinet$K.key="${ssid_passwd}"
|
||||
uci set wireless.wifinet$K.wpa_group_rekey='601'
|
||||
uci set wireless.wifinet$K.max_inactivity='301'
|
||||
if uci get wireless.${radio}.path | grep -q bcma || iwinfo wlan${radio:5} info | grep -qi Cypress; then
|
||||
WLAN_IDX=${radio:5}
|
||||
uci set wireless.wifinet$K.ifname="wlan${WLAN_IDX}"
|
||||
else
|
||||
uci set wireless.wifinet$K.ieee80211r='1'
|
||||
uci set wireless.wifinet$K.ft_over_ds='0'
|
||||
uci set wireless.wifinet$K.ft_psk_generate_local='1'
|
||||
fi
|
||||
|
||||
uci delete wireless.wifinet$K.disabled 2>/dev/null
|
||||
K=$((K+1))
|
||||
fi
|
||||
done
|
||||
while uci get wireless.wifinet$K 2>/dev/null; do
|
||||
uci set wireless.wifinet$K.disabled='1'
|
||||
K=$((K+1))
|
||||
done
|
||||
|
||||
logger -t fakemesh "agent_lost_ac($pid): starting wifi SSID=\'${ssid}\' on ${radio} $band!"
|
||||
|
||||
nft_add_brmeshfilters() {
|
||||
brif="$1"
|
||||
nft add table netdev brmeshfilters_$brif 2>/dev/null
|
||||
nft "add chain netdev brmeshfilters_$brif devfilter { type filter hook ingress device $brif priority 0 ; }" 2>/dev/null
|
||||
nft add rule netdev brmeshfilters_$brif devfilter udp sport 68 drop 2>/dev/null
|
||||
}
|
||||
|
||||
#drop all in-comming DHCP request from eth port
|
||||
for brif in $(cd /sys/class/net/br-lan/brif/ && ls); do
|
||||
iwinfo $brif info &>/dev/null && [ "$brif" != "meshx0" ] && [ "$brif" != "meshx1" ] && continue
|
||||
nft_add_brmeshfilters $brif
|
||||
done
|
||||
|
||||
/etc/init.d/network reload
|
||||
/etc/init.d/dnsmasq reload
|
||||
sleep 5
|
||||
uci revert dhcp
|
||||
uci revert network
|
||||
uci revert wireless
|
||||
|
||||
#drop all in-comming DHCP request from eth port
|
||||
#XXX: since network reload, netdevice may unregister and re-create, it is safe to re-add filter rules again.
|
||||
for brif in $(cd /sys/class/net/br-lan/brif/ && ls); do
|
||||
iwinfo $brif info &>/dev/null && [ "$brif" != "meshx0" ] && [ "$brif" != "meshx1" ] && continue
|
||||
nft_add_brmeshfilters $brif
|
||||
done
|
||||
|
||||
logger -t fakemesh "agent_lost_ac($pid): done!"
|
||||
|
||||
#make sure agent_sync_config stopped
|
||||
rm -rf /tmp/fakemesh_lck3
|
||||
lost_ac=$lost_ac exec /usr/sbin/fakemesh agent_sync_config &
|
||||
}
|
||||
|
||||
agent_sync_config()
|
||||
{
|
||||
[ "$sync_ac" = "1" ] || {
|
||||
return 0
|
||||
}
|
||||
[ "$role" = "wap" ] && {
|
||||
#make sure agent_keep_alive stopped
|
||||
rm -rf /tmp/fakemesh_lck2*
|
||||
}
|
||||
|
||||
mkdir /tmp/fakemesh_lck3 || return 0
|
||||
pid=$$
|
||||
touch /tmp/fakemesh_lck3/$pid
|
||||
|
||||
logger -t fakemesh "agent_sync_config($pid): started!"
|
||||
|
||||
touch /tmp/fakemesh.ac.config
|
||||
ln -s /tmp/fakemesh.ac.config /etc/config/fakemeshac 2>/dev/null
|
||||
|
||||
while :; do
|
||||
[ "$role" != "controller" ] && {
|
||||
if test $lost_ac -gt 2; then
|
||||
ubus call network.interface.meshx0 down
|
||||
sleep 1
|
||||
ubus call network.interface.meshx0 up
|
||||
sleep 1
|
||||
fi
|
||||
ubus -t 15 wait_for network.interface.meshx0
|
||||
}
|
||||
sleep 15
|
||||
achost=controller.fakemesh
|
||||
if [ "$role" != "controller" ]; then
|
||||
if test $lost_ac -gt 0; then
|
||||
/etc/init.d/umdns reload
|
||||
sleep 5
|
||||
fi
|
||||
achost="$(ubus call umdns browse | jsonfilter -e "@['_fakemesh_${Xid}._tcp'][*]['ipv4']")"
|
||||
if ! test -n "$achost"; then
|
||||
logger -t fakemesh "agent_sync_config($pid): umdns: achost not found(lost_ac=$lost_ac)!"
|
||||
achost=controller.fakemesh
|
||||
fi
|
||||
acnum=$(echo -n "$achost" | wc -w)
|
||||
if [ "$acnum" -gt 1 ]; then
|
||||
logger -t fakemesh "agent_sync_config($pid): umdns: achost found $acnum($achost)(lost_ac=$lost_ac)!"
|
||||
rand=$(hexdump -e '"%u"' -n1 /dev/urandom)
|
||||
rand=$(((rand % acnum) + 1))
|
||||
achost=$(for w in $achost; do echo $w; done | head -n$rand | tail -n1)
|
||||
logger -t fakemesh "agent_sync_config($pid): umdns: achost found random select($achost)(lost_ac=$lost_ac)!"
|
||||
fi
|
||||
fi
|
||||
|
||||
hash=$(echo -n ${Xid}${Xkey} | md5sum | head -c32)
|
||||
if ( \
|
||||
[ "$role" = "controller" ] && cp /etc/config/fakemesh /tmp/fakemesh.ac.config.tmp || \
|
||||
timeout 10 wget -4 -qO /tmp/fakemesh.ac.config.tmp http://$achost/fakemesh.$hash 2>/dev/null ); then
|
||||
:
|
||||
else
|
||||
lost_ac=$((lost_ac+1))
|
||||
logger -t fakemesh "agent_sync_config($pid): fetch config from $achost failed($lost_ac)!"
|
||||
acip=$(ip route | grep "default via" -m1 | awk '{print $3}')
|
||||
if test -n "$acip" && ifconfig br-lan | grep -q "addr:$acip "; then
|
||||
logger -t fakemesh "agent_sync_config($pid): acip=$acip is setup on br-lan(lost_ac=$lost_ac)!"
|
||||
ubus call network.interface.lan down
|
||||
/etc/init.d/network reload
|
||||
sleep 5
|
||||
fi
|
||||
if test -n "$acip" && [ "$role" != "controller" ] && timeout 5 wget -4 -qO /tmp/fakemesh.ac.config.tmp http://$acip/fakemesh.$hash 2>/dev/null; then
|
||||
logger -t fakemesh "agent_sync_config($pid): fetch config from gateway($acip) ok(lost_ac=$lost_ac)"
|
||||
elif test -n "$achost" && [ "$role" != "controller" ] && timeout 5 wget -4 -qO /tmp/fakemesh.ac.config.tmp http://$achost/fakemesh.$hash 2>/dev/null; then
|
||||
logger -t fakemesh "agent_sync_config($pid): fetch config from achost($achost) ok(lost_ac=$lost_ac)"
|
||||
else
|
||||
if test $lost_ac -ge $LOST_AC_CNT; then
|
||||
lost_ac=$lost_ac exec /usr/sbin/fakemesh agent_lost_ac &
|
||||
return 0
|
||||
fi
|
||||
logger -t fakemesh "agent_sync_config($pid): fetch config from achost($achost)/gateway($acip) failed($lost_ac), wait 30s"
|
||||
sleep 30
|
||||
rm -f /tmp/fakemesh.ac.config.tmp
|
||||
test -f /tmp/fakemesh_lck3/$pid || return 0
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! grep -q fakemesh /tmp/fakemesh.ac.config.tmp; then
|
||||
rm -f /tmp/fakemesh.ac.config.tmp
|
||||
test -f /tmp/fakemesh_lck3/$pid || return 0
|
||||
continue
|
||||
fi
|
||||
|
||||
mv /tmp/fakemesh.ac.config.tmp /tmp/fakemesh.ac.config
|
||||
|
||||
test $lost_ac -gt 0 && logger -t fakemesh "agent_sync_config($pid): fetch config ok!"
|
||||
|
||||
oldbsh=$(uci get fakemesh.default.band_steer_helper || echo usteer)
|
||||
newbsh=$(uci get fakemeshac.default.band_steer_helper || echo usteer)
|
||||
[ "${oldbsh}" = "${newbsh}" ] || {
|
||||
uci set fakemesh.default.band_steer_helper="${newbsh}"
|
||||
uci commit fakemesh
|
||||
band_steer_helper="${newbsh}" exec /usr/sbin/fakemesh band_steer_helper_switch &
|
||||
}
|
||||
|
||||
oldcfgmd5=$(uci get fakemesh.default.wifim_md5 2>/dev/null)
|
||||
newcfgmd5=$(uci show fakemeshac | grep "^fakemeshac.@wifim" | md5sum | head -c 32)
|
||||
[ "${oldcfgmd5}" = "${newcfgmd5}" ] || {
|
||||
logger -t fakemesh "agent_sync_config($pid): config change!"
|
||||
#delete old wifi config
|
||||
I=0
|
||||
while uci get wireless.@wifi-iface[$I] &>/dev/null; do
|
||||
if uci show wireless.@wifi-iface[$I] | grep -q wireless.meshx[01]=wifi-iface; then
|
||||
I=$((I+1))
|
||||
continue
|
||||
fi
|
||||
uci delete wireless.@wifi-iface[$I] &>/dev/null
|
||||
done
|
||||
|
||||
J=0
|
||||
K=0
|
||||
while uci get fakemeshac.@wifim[$J] &>/dev/null; do
|
||||
ssid=$(uci get fakemeshac.@wifim[$J].ssid)
|
||||
encryption=$(uci get fakemeshac.@wifim[$J].encryption)
|
||||
key=$(uci get fakemeshac.@wifim[$J].key)
|
||||
bands=$(uci get fakemeshac.@wifim[$J].band)
|
||||
enabled=$(uci get fakemeshac.@wifim[$J].enabled || echo 1)
|
||||
|
||||
[ "$bands" = "2g5g" ] && bands="2g 5g"
|
||||
|
||||
[ "$enabled" = "1" ] && {
|
||||
for band in $bands; do
|
||||
wbandstr=$(uci show wireless | grep .band=\'${band}\'$ -m1)
|
||||
if test -n "$wbandstr"; then
|
||||
radio=$(echo $wbandstr | cut -d\. -f2)
|
||||
|
||||
uci set wireless.wifinet$K=wifi-iface
|
||||
uci set wireless.wifinet$K.device="${radio}"
|
||||
if [ "$role" = "controller" ]; then
|
||||
uci set wireless.wifinet$K.network='lan'
|
||||
else
|
||||
uci set wireless.wifinet$K.network='meshx0'
|
||||
fi
|
||||
uci set wireless.wifinet$K.mode='ap'
|
||||
uci set wireless.wifinet$K.ssid="${ssid}"
|
||||
uci set wireless.wifinet$K.wpa_group_rekey='601'
|
||||
uci set wireless.wifinet$K.max_inactivity='301'
|
||||
if [ "${encryption}" != "none" ]; then
|
||||
uci set wireless.wifinet$K.encryption="${encryption}"
|
||||
uci set wireless.wifinet$K.key="${key}"
|
||||
else
|
||||
uci set wireless.wifinet$K.encryption='none'
|
||||
fi
|
||||
if uci get wireless.${radio}.path | grep -q bcma || iwinfo wlan${radio:5} info | grep -qi Cypress; then
|
||||
WLAN_IDX=${radio:5}
|
||||
uci set wireless.wifinet$K.ifname="wlan${WLAN_IDX}"
|
||||
else
|
||||
uci set wireless.wifinet$K.ieee80211r='1'
|
||||
uci set wireless.wifinet$K.ft_over_ds='1'
|
||||
uci set wireless.wifinet$K.ft_psk_generate_local='1'
|
||||
fi
|
||||
if opkg list-installed | grep -q wpad-basic; then
|
||||
:
|
||||
else
|
||||
uci set wireless.wifinet$K.bss_transition='1'
|
||||
uci set wireless.wifinet$K.wnm_sleep_mode='1'
|
||||
uci set wireless.wifinet$K.time_advertisement='2'
|
||||
uci set wireless.wifinet$K.time_zone='GMT0'
|
||||
uci set wireless.wifinet$K.ieee80211k='1'
|
||||
uci set wireless.wifinet$K.rrm_neighbor_report='1'
|
||||
uci set wireless.wifinet$K.rrm_beacon_report='1'
|
||||
fi
|
||||
|
||||
K=$((K+1))
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
J=$((J+1))
|
||||
done
|
||||
|
||||
uci set fakemesh.default.wifim_md5="${newcfgmd5}"
|
||||
|
||||
uci commit fakemesh
|
||||
uci commit wireless
|
||||
/etc/init.d/network reload &
|
||||
}
|
||||
|
||||
test -f /tmp/fakemesh_lck3/$pid || return 0
|
||||
|
||||
if test $lost_ac -ge $LOST_AC_CNT; then
|
||||
logger -t fakemesh "agent_sync_config($pid): recovery from lost_ac=$lost_ac!"
|
||||
sleep 5
|
||||
/etc/init.d/network reload
|
||||
/etc/init.d/dnsmasq reload
|
||||
nft list tables 2>/dev/null | grep 'table netdev brmeshfilters_' | while read tb; do
|
||||
nft delete $tb
|
||||
done
|
||||
test -x /etc/init.d/umdns && /etc/init.d/umdns reload
|
||||
test -x /etc/init.d/dawn && /etc/init.d/dawn restart
|
||||
fi
|
||||
lost_ac=0
|
||||
|
||||
rand=$(hexdump -e '"%u"' -n1 /dev/urandom)
|
||||
sleep $((50+(rand+0)%20))
|
||||
test -f /tmp/fakemesh_lck3/$pid || return 0
|
||||
done
|
||||
|
||||
rm -f /tmp/fakemesh_lck3/$pid; rmdir /tmp/fakemesh_lck3
|
||||
}
|
||||
|
||||
agent_keep_alive()
|
||||
{
|
||||
[ "$role" = "agent" ] || return 0
|
||||
|
||||
sta_lost=0
|
||||
|
||||
wbandstr=$(uci show wireless | grep .band=\'${band}\'$ -m1)
|
||||
radio=$(echo $wbandstr | cut -d\. -f2)
|
||||
channel=$(uci get wireless.${radio}.channel)
|
||||
test -n "$channel" || return 1
|
||||
|
||||
mkdir /tmp/fakemesh_lck2 || return 0
|
||||
pid=$$
|
||||
touch /tmp/fakemesh_lck2/$pid
|
||||
|
||||
logger -t fakemesh "agent_keep_alive($pid): started!"
|
||||
while :; do
|
||||
sleep 10
|
||||
sta="$(ubus -S list wpa_supplicant.meshx1)"
|
||||
if test -n "$sta"; then
|
||||
if [ $(iwinfo meshx1 info | grep -c 'ESSID: unknown') -ge 1 ]; then
|
||||
sta_lost=$((sta_lost+1))
|
||||
if [ "$sta_lost" -ge 3 ]; then
|
||||
logger -t fakemesh "agent_keep_alive($pid): Agent lost connection!"
|
||||
rm -f /tmp/fakemesh_lck2/$pid; rmdir /tmp/fakemesh_lck2
|
||||
exec /usr/sbin/fakemesh agent_fix_channel &
|
||||
return 0
|
||||
fi
|
||||
elif [ "$(iwinfo meshx1 info | head -n3 | tail -n1 | awk '{print $4}')" != "$channel" ]; then
|
||||
logger -t fakemesh "agent_keep_alive($pid): Agent channel changed!"
|
||||
rm -f /tmp/fakemesh_lck2/$pid; rmdir /tmp/fakemesh_lck2
|
||||
exec /usr/sbin/fakemesh agent_fix_channel &
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
sleep 30
|
||||
test -f /tmp/fakemesh_lck2/$pid || return 0
|
||||
done
|
||||
|
||||
rm -f /tmp/fakemesh_lck2/$pid; rmdir /tmp/fakemesh_lck2
|
||||
}
|
||||
|
||||
agent_fix_channel()
|
||||
{
|
||||
exec /usr/sbin/fakemesh agent_sync_config &
|
||||
|
||||
[ "$role" = "agent" ] || return 0
|
||||
|
||||
wbandstr=$(uci show wireless | grep .band=\'${band}\'$ -m1)
|
||||
radio=$(echo $wbandstr | cut -d\. -f2)
|
||||
channel=$(uci get wireless.${radio}.channel)
|
||||
test -n "$channel" || return 1
|
||||
|
||||
mkdir /tmp/fakemesh_lck1 || return 0
|
||||
pid=$$
|
||||
touch /tmp/fakemesh_lck1/$pid
|
||||
|
||||
logger -t fakemesh "agent_fix_channel($pid): started!"
|
||||
while :; do
|
||||
sleep 10
|
||||
sta="$(ubus -S list wpa_supplicant.meshx1)"
|
||||
if test -n "$sta"; then
|
||||
chan=$(iwinfo meshx1 scan | grep -A1 -B1 "ESSID: \"${Xid}\"" | head -n3 | tail -n1 | grep -io "Channel:.*"| awk '{print $2}')
|
||||
if test -n "$chan"; then
|
||||
if [ "$chan" != "$channel" ]; then
|
||||
logger -t fakemesh "agent_fix_channel($pid): Setting up channel ($chan) for ${radio}"
|
||||
uci set wireless.${radio}.channel="$chan"
|
||||
test "$chan" -ge "36" -a "$chan" -le "44" || {
|
||||
htmode=$(uci get wireless.${radio}.htmode 2>/dev/null)
|
||||
if [ "$htmode" = "VHT160" ]; then
|
||||
uci set wireless.${radio}.htmode="VHT80"
|
||||
elif [ "$htmode" = "HE160" ]; then
|
||||
uci set wireless.${radio}.htmode="HE80"
|
||||
fi
|
||||
}
|
||||
uci commit wireless
|
||||
/etc/init.d/network reload &
|
||||
fi
|
||||
logger -t fakemesh "agent_fix_channel($pid): Channel ($chan) for ${radio} ready!"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
sleep 20
|
||||
test -f /tmp/fakemesh_lck1/$pid || return 0
|
||||
done
|
||||
|
||||
rm -f /tmp/fakemesh_lck1/$pid; rmdir /tmp/fakemesh_lck1
|
||||
|
||||
exec /usr/sbin/fakemesh agent_keep_alive &
|
||||
}
|
||||
|
||||
[ "x$1" = "xagent_lost_ac" ] && {
|
||||
agent_lost_ac
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ "x$1" = "xagent_fix_channel" ] && {
|
||||
agent_fix_channel
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ "x$1" = "xagent_keep_alive" ] && {
|
||||
agent_keep_alive
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ "x$1" = "xagent_sync_config" ] && {
|
||||
agent_sync_config
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ "x$1" = "xgen_config" ] && {
|
||||
# http://controller.fakemesh/fakemesh.435ca8a686ae9f07eb4eb67d2216b154
|
||||
[ "$role" = "controller" ] && {
|
||||
hash=$(echo -n ${Xid}${Xkey} | md5sum | head -c32)
|
||||
ln -s /etc/config/fakemesh /www/fakemesh.$hash 2>/dev/null
|
||||
for f in $(ls /www/fakemesh.*); do
|
||||
[ "$f" != "/www/fakemesh.$hash" ] && rm -f "$f"
|
||||
done
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
|
||||
test -n "${Xid}" || {
|
||||
exit 0
|
||||
}
|
||||
|
||||
rm -rf /tmp/fakemesh_lck*
|
||||
|
||||
MACADDR=""
|
||||
test -e /usr/share/natcapd/board_mac.lua && MACADDR=$(lua /usr/share/natcapd/board_mac.lua)
|
||||
test -n "$MACADDR" || MACADDR=$(. /lib/functions/system.sh; get_mac_label | tr a-f A-F)
|
||||
test -n "$MACADDR" || MACADDR=$(cat /etc/board.json | jsonfilter -e "$['network']['wan']['macaddr']" | tr a-f A-F)
|
||||
test -n "$MACADDR" || MACADDR=$(cat /etc/board.json | jsonfilter -e "$['network']['lan']['macaddr']" | tr a-f A-F)
|
||||
test -n "$MACADDR" || MACADDR=$(cat /sys/class/net/eth0/address | tr a-f A-F)
|
||||
test -n "$MACADDR" || MACADDR=$(cat /sys/class/net/eth1/address | tr a-f A-F)
|
||||
test -n "$MACADDR" || MACADDR=$(head -c6 /dev/urandom | hexdump -e '/1 "%02X:"' | head -c17)
|
||||
test -n "$MACADDR" || MACADDR=$(head -c6 /dev/random | hexdump -e '/1 "%02X:"' | head -c17)
|
||||
|
||||
if [ "$role" = "controller" ]; then
|
||||
|
||||
rm -rf /tmp/fakemesh_lck*
|
||||
|
||||
test -e /etc/init.d/umdns && {
|
||||
mkdir -p /etc/umdns
|
||||
ln -s /tmp/fakemesh.umdns.json /etc/umdns 2>/dev/null
|
||||
umdns_json="{
|
||||
\"fakemesh\": {
|
||||
\"service\": \"_fakemesh_${Xid}._tcp.local\",
|
||||
\"port\": 65535,
|
||||
\"txt\": [ \"id=${Xid}\" ]
|
||||
}
|
||||
}"
|
||||
[ "$(cat /tmp/fakemesh.umdns.json 2>/dev/null | md5sum | head -c32)" = "$(echo "$umdns_json" | md5sum | head -c32)" ] || {
|
||||
echo "$umdns_json" >/tmp/fakemesh.umdns.json
|
||||
/etc/init.d/umdns restart
|
||||
}
|
||||
}
|
||||
|
||||
# wireless.radio0.band='2g'
|
||||
wbandstr=$(uci show wireless | grep .band=\'${band}\'$ -m1)
|
||||
if test -n "$wbandstr"; then
|
||||
radio=$(echo $wbandstr | cut -d\. -f2) # radio0
|
||||
|
||||
#meshx0
|
||||
uci set wireless.meshx0=wifi-iface
|
||||
uci set wireless.meshx0.device="${radio}"
|
||||
uci set wireless.meshx0.network='lan'
|
||||
uci set wireless.meshx0.ifname='meshx0'
|
||||
uci set wireless.meshx0.mode='ap'
|
||||
uci set wireless.meshx0.wds='1'
|
||||
uci set wireless.meshx0.ssid="${Xid}"
|
||||
uci set wireless.meshx0.hidden='1'
|
||||
uci set wireless.meshx0.wpa_group_rekey='601'
|
||||
uci set wireless.meshx0.max_inactivity='301'
|
||||
if test -n "${Xkey}"; then
|
||||
uci set wireless.meshx0.encryption='psk2'
|
||||
uci set wireless.meshx0.key="${Xkey}"
|
||||
else
|
||||
uci set wireless.meshx0.encryption='none'
|
||||
fi
|
||||
if [ "$fronthaul_disabled" = "1" ]; then
|
||||
uci set wireless.meshx0.disabled='1'
|
||||
else
|
||||
uci delete wireless.meshx0.disabled 2>/dev/null
|
||||
fi
|
||||
|
||||
#meshx1
|
||||
uci delete wireless.meshx1 &>/dev/null
|
||||
fi
|
||||
|
||||
uci delete dhcp.meshx0 &>/dev/null
|
||||
uci delete network.meshx0 &>/dev/null
|
||||
uci delete network.meshx0_6 &>/dev/null
|
||||
|
||||
#re-enable lan
|
||||
uci delete network.lan.auto &>/dev/null
|
||||
#re-enable wan
|
||||
uci delete network.wan.auto &>/dev/null
|
||||
uci delete network.wan6.auto &>/dev/null
|
||||
#del wan port from br-lan
|
||||
lan_idx=0
|
||||
while uci get network.@device[$lan_idx] &>/dev/null && [ $(uci get network.@device[$lan_idx].name) != "br-lan" ]; do lan_idx=$((lan_idx+1)); done
|
||||
lan_ports="$(uci get network.@device[$lan_idx].ports 2>/dev/null)"
|
||||
wan_port="$(uci get network.wan.device 2>/dev/null)"
|
||||
newlan_ports=$(for lp in $lan_ports; do [ "$lp" = "$wan_port" ] || echo $lp; done | sort | uniq)
|
||||
newlan_ports=$(echo $newlan_ports)
|
||||
[ "$lan_ports" != "$newlan_ports" ] && {
|
||||
uci delete network.@device[$lan_idx].ports &>/dev/null
|
||||
for lp in $newlan_ports; do
|
||||
uci add_list network.@device[$lan_idx].ports="$lp"
|
||||
done
|
||||
}
|
||||
|
||||
#delete meshx0 from lan zone
|
||||
lan_idx=0
|
||||
while uci get firewall.@zone[$lan_idx] &>/dev/null && [ $(uci get firewall.@zone[$lan_idx].name) != "lan" ]; do lan_idx=$((lan_idx+1)); done
|
||||
lan_net="$(uci get firewall.@zone[$lan_idx].network 2>/dev/null)"
|
||||
newlan_net=$(for ln in $lan_net; do [ "$ln" = "meshx0" -o "$ln" = "meshx0_6" ] || echo $ln; done | sort | uniq)
|
||||
newlan_net=$(echo $newlan_net)
|
||||
[ "$lan_net" != "$newlan_net" ] && {
|
||||
uci delete firewall.@zone[$lan_idx].network &>/dev/null
|
||||
for ln in $newlan_net; do
|
||||
uci add_list firewall.@zone[$lan_idx].network="$ln"
|
||||
done
|
||||
uci commit firewall
|
||||
}
|
||||
|
||||
# reload firewall
|
||||
uci delete firewall.fakemesh &>/dev/null && uci commit firewall
|
||||
|
||||
mkdir -p /usr/share/fakemesh
|
||||
cat >/tmp/fakemesh.firewall.include <<-EOT
|
||||
#!/bin/sh
|
||||
iptables -t nat -C prerouting_lan_rule -d $access_ip/32 -p tcp --dport 80 -j REDIRECT --to-ports 80 2>/dev/null || \
|
||||
iptables -t nat -A prerouting_lan_rule -d $access_ip/32 -p tcp --dport 80 -j REDIRECT --to-ports 80 2>/dev/null
|
||||
iptables -t nat -C prerouting_lan_rule -d $access_ip/32 -p tcp --dport 443 -j REDIRECT --to-ports 443 2>/dev/null || \
|
||||
iptables -t nat -A prerouting_lan_rule -d $access_ip/32 -p tcp --dport 443 -j REDIRECT --to-ports 443 2>/dev/null
|
||||
|
||||
nft -a list chain inet fw4 dstnat 2>/dev/null | grep -o "fakemesh.*" | while read _ _ _ handle; do nft delete rule inet fw4 dstnat handle \$handle; done
|
||||
nft insert rule inet fw4 dstnat iifname { \$(echo \$(fw4 -q zone lan | grep -v '*' | sort | uniq | sed 's/\(.*\)/"\1",/g') | sed 's/,$//') } ip daddr $access_ip/32 tcp dport 80 counter redirect to :80 comment "fakemesh" 2>/dev/null
|
||||
nft insert rule inet fw4 dstnat iifname { \$(echo \$(fw4 -q zone lan | grep -v '*' | sort | uniq | sed 's/\(.*\)/"\1",/g') | sed 's/,$//') } ip daddr $access_ip/32 tcp dport 443 counter redirect to :443 comment "fakemesh" 2>/dev/null
|
||||
|
||||
EOT
|
||||
ln -s /tmp/fakemesh.firewall.include /usr/share/fakemesh/firewall.include 2>/dev/null
|
||||
grep -q "^sh /usr/share/fakemesh/firewall.include" /etc/firewall.include || echo "sh /usr/share/fakemesh/firewall.include" >>/etc/firewall.include
|
||||
|
||||
grep -q "^$access_ip controller.fakemesh ac.fakemesh" /etc/hosts || {
|
||||
if grep -q ".* controller.fakemesh ac.fakemesh" /etc/hosts; then
|
||||
sed -i "s/.* controller.fakemesh ac.fakemesh/$access_ip controller.fakemesh ac.fakemesh/" /etc/hosts
|
||||
else
|
||||
echo "$access_ip controller.fakemesh ac.fakemesh" >>/etc/hosts
|
||||
fi
|
||||
/etc/init.d/dnsmasq reload
|
||||
}
|
||||
|
||||
/etc/init.d/firewall reload &>/dev/null
|
||||
|
||||
exec /usr/sbin/fakemesh gen_config &
|
||||
|
||||
uci changes
|
||||
|
||||
test $(uci changes 2>/dev/null | grep -v "='dhcp'\|='interface'\|='wifi-iface'" | wc -l) -le 0 && {
|
||||
uci revert wireless
|
||||
uci revert dhcp
|
||||
uci revert network
|
||||
|
||||
exec /usr/sbin/fakemesh agent_sync_config &
|
||||
exit 0
|
||||
}
|
||||
|
||||
uci commit wireless
|
||||
uci commit dhcp
|
||||
uci commit network
|
||||
|
||||
(sleep 15
|
||||
/etc/init.d/network reload
|
||||
/etc/init.d/dnsmasq reload
|
||||
exec /usr/sbin/fakemesh agent_sync_config & )&
|
||||
else
|
||||
rm -f /www/fakemesh.*
|
||||
/etc/init.d/sta_disable enabled 2>/dev/null && /etc/init.d/sta_disable disable
|
||||
|
||||
test -e /etc/init.d/umdns && {
|
||||
rm /tmp/fakemesh.umdns.json 2>/dev/null && \
|
||||
/etc/init.d/umdns restart
|
||||
}
|
||||
|
||||
# wireless.radio0.band='2g'
|
||||
wbandstr=$(uci show wireless | grep .band=\'${band}\'$ -m1)
|
||||
if test -n "$wbandstr"; then
|
||||
radio=$(echo $wbandstr | cut -d\. -f2) # radio0
|
||||
|
||||
#meshx0
|
||||
uci set wireless.meshx0=wifi-iface
|
||||
uci set wireless.meshx0.device="${radio}"
|
||||
uci set wireless.meshx0.network='meshx0'
|
||||
uci set wireless.meshx0.ifname='meshx0'
|
||||
uci set wireless.meshx0.mode='ap'
|
||||
uci set wireless.meshx0.wds='1'
|
||||
uci set wireless.meshx0.ssid="${Xid}"
|
||||
uci set wireless.meshx0.hidden='1'
|
||||
uci set wireless.meshx0.wpa_group_rekey='601'
|
||||
uci set wireless.meshx0.max_inactivity='301'
|
||||
if test -n "${Xkey}"; then
|
||||
uci set wireless.meshx0.encryption='psk2'
|
||||
uci set wireless.meshx0.key="${Xkey}"
|
||||
else
|
||||
uci set wireless.meshx0.encryption='none'
|
||||
fi
|
||||
if [ "$fronthaul_disabled" = "1" ]; then
|
||||
uci set wireless.meshx0.disabled='1'
|
||||
else
|
||||
uci delete wireless.meshx0.disabled 2>/dev/null
|
||||
fi
|
||||
|
||||
#meshx1
|
||||
uci set wireless.meshx1=wifi-iface
|
||||
uci set wireless.meshx1.device="${radio}"
|
||||
uci set wireless.meshx1.network='meshx0'
|
||||
uci set wireless.meshx1.ifname='meshx1'
|
||||
uci set wireless.meshx1.mode='sta'
|
||||
uci set wireless.meshx1.wds='1'
|
||||
uci set wireless.meshx1.ssid="${Xid}"
|
||||
if test -n "${Xkey}"; then
|
||||
uci set wireless.meshx1.encryption='psk2'
|
||||
uci set wireless.meshx1.key="${Xkey}"
|
||||
else
|
||||
uci set wireless.meshx1.encryption='none'
|
||||
fi
|
||||
if [ "$role" = "wap" ]; then
|
||||
uci set wireless.meshx1.disabled='1'
|
||||
else
|
||||
uci delete wireless.meshx1.disabled 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ "$role" = "agent" ] && [ "$(uci get wireless.${radio}.channel 2>/dev/null || echo auto)" = "auto" ]; then
|
||||
if [ "$band" = "5g" ]; then
|
||||
uci set wireless.${radio}.channel='36'
|
||||
else
|
||||
uci set wireless.${radio}.channel='1'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
uci set dhcp.meshx0=dhcp
|
||||
uci set dhcp.meshx0.ignore='1'
|
||||
|
||||
uci set network.lan.auto='0'
|
||||
|
||||
uci set network.meshx0=interface
|
||||
uci set network.meshx0.device="$(uci get network.lan.device)"
|
||||
uci set network.meshx0.proto='dhcp'
|
||||
uci set network.meshx0.defaultroute='1'
|
||||
uci set network.meshx0.metric='10'
|
||||
uci set network.meshx0.hostname="MESH-AGENT_$(echo -n $MACADDR | sed 's/://g' | tr a-f A-F)"
|
||||
|
||||
uci set network.meshx0_6=interface
|
||||
uci set network.meshx0_6.proto='dhcpv6'
|
||||
uci set network.meshx0_6.device='@meshx0'
|
||||
uci set network.meshx0_6.reqaddress='try'
|
||||
uci set network.meshx0_6.reqprefix='auto'
|
||||
uci set network.meshx0_6.delegate='0'
|
||||
uci set network.meshx0_6.hostname="MESH-AGENT_$(echo -n $MACADDR | sed 's/://g' | tr a-f A-F)"
|
||||
|
||||
#add meshx0 to lan zone
|
||||
lan_idx=0
|
||||
while uci get firewall.@zone[$lan_idx] &>/dev/null && [ $(uci get firewall.@zone[$lan_idx].name) != "lan" ]; do lan_idx=$((lan_idx+1)); done
|
||||
lan_net="$(uci get firewall.@zone[$lan_idx].network 2>/dev/null)"
|
||||
newlan_net=$(for ln in $lan_net meshx0 meshx0_6; do echo $ln; done | sort | uniq)
|
||||
newlan_net=$(echo $newlan_net)
|
||||
[ "$lan_net" != "$newlan_net" ] && {
|
||||
uci delete firewall.@zone[$lan_idx].network &>/dev/null
|
||||
for ln in $newlan_net; do
|
||||
uci add_list firewall.@zone[$lan_idx].network="$ln"
|
||||
done
|
||||
uci commit firewall
|
||||
}
|
||||
|
||||
#disable wan
|
||||
uci set network.wan.auto='0' 2>/dev/null
|
||||
uci set network.wan6.auto='0' 2>/dev/null
|
||||
#add wan port to br-lan
|
||||
lan_idx=0
|
||||
while uci get network.@device[$lan_idx] &>/dev/null && [ $(uci get network.@device[$lan_idx].name) != "br-lan" ]; do lan_idx=$((lan_idx+1)); done
|
||||
lan_ports="$(uci get network.@device[$lan_idx].ports 2>/dev/null)"
|
||||
wan_port="$(uci get network.wan.device 2>/dev/null)"
|
||||
newlan_ports=$(for lp in $lan_ports $wan_port; do echo $lp; done | sort | uniq)
|
||||
newlan_ports=$(echo $newlan_ports)
|
||||
[ "$lan_ports" != "$newlan_ports" ] && {
|
||||
uci delete network.@device[$lan_idx].ports &>/dev/null
|
||||
for lp in $newlan_ports; do
|
||||
uci add_list network.@device[$lan_idx].ports="$lp"
|
||||
done
|
||||
}
|
||||
|
||||
# reload firewall
|
||||
uci delete firewall.fakemesh &>/dev/null && uci commit firewall
|
||||
|
||||
mkdir -p /usr/share/fakemesh
|
||||
cat >/tmp/fakemesh.firewall.include <<-EOT
|
||||
#!/bin/sh
|
||||
iptables -t filter -C output_lan_rule -j MARK --set-xmark 0x00010000/0x00010000 2>/dev/null || \
|
||||
iptables -t filter -A output_lan_rule -j MARK --set-xmark 0x00010000/0x00010000 2>/dev/null
|
||||
iptables -t nat -C zone_lan_postrouting -m mark --mark 0x00010000/0x00010000 -j MASQUERADE 2>/dev/null || \
|
||||
iptables -t nat -A zone_lan_postrouting -m mark --mark 0x00010000/0x00010000 -j MASQUERADE 2>/dev/null
|
||||
|
||||
nft -a list chain inet fw4 output_lan 2>/dev/null | grep -o "fakemesh_mark_0x10000.*" | while read _ _ _ handle; do nft delete rule inet fw4 output_lan handle \$handle; done
|
||||
nft insert rule inet fw4 output_lan counter meta mark set mark or 0x10000 comment "fakemesh_mark_0x10000" 2>/dev/null
|
||||
|
||||
nft -a list chain inet fw4 srcnat 2>/dev/null | grep -o "fakemesh_mark_0x10000.*" | while read _ _ _ handle; do nft delete rule inet fw4 srcnat handle \$handle; done
|
||||
nft insert rule inet fw4 srcnat oifname { \$(echo \$(fw4 -q zone lan | grep -v '*' | sort | uniq | sed 's/\(.*\)/"\1",/g') | sed 's/,$//') } mark and 0x10000 == 0x10000 counter masquerade comment "fakemesh_mark_0x10000" 2>/dev/null
|
||||
EOT
|
||||
ln -s /tmp/fakemesh.firewall.include /usr/share/fakemesh/firewall.include 2>/dev/null
|
||||
grep -q "^sh /usr/share/fakemesh/firewall.include" /etc/firewall.include || echo "sh /usr/share/fakemesh/firewall.include" >>/etc/firewall.include
|
||||
|
||||
/etc/init.d/firewall reload &>/dev/null
|
||||
|
||||
uci changes
|
||||
|
||||
test $(uci changes 2>/dev/null | grep -v "='dhcp'\|='interface'\|='wifi-iface'" | wc -l) -le 0 && {
|
||||
uci revert wireless
|
||||
uci revert dhcp
|
||||
uci revert network
|
||||
|
||||
exec /usr/sbin/fakemesh agent_fix_channel &
|
||||
exit 0
|
||||
}
|
||||
|
||||
uci commit wireless
|
||||
uci commit dhcp
|
||||
uci commit network
|
||||
sed -i "/.* controller.fakemesh/d" /etc/hosts
|
||||
|
||||
(sleep 15
|
||||
/etc/init.d/network reload
|
||||
/etc/init.d/dnsmasq reload
|
||||
exec /usr/sbin/fakemesh agent_fix_channel & )&
|
||||
fi
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"admin/mesh": {
|
||||
"title": "MESH",
|
||||
"order": 60,
|
||||
"action": {
|
||||
"type": "firstchild",
|
||||
"recurse": true
|
||||
}
|
||||
},
|
||||
"admin/mesh/fakemesh": {
|
||||
"title": "Fake Mesh",
|
||||
"order": 1,
|
||||
"action": {
|
||||
"type": "firstchild",
|
||||
"type": "view",
|
||||
"path": "fakemesh/fakemesh"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-fakemesh" ],
|
||||
"uci": { "fakemesh": true }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-fakemesh": {
|
||||
"description": "Grant UCI access for luci-app-fakemesh",
|
||||
"read": {
|
||||
"uci": [ "fakemesh", "network", "wireless", "dhcp" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "fakemesh", "network", "wireless", "dhcp" ]
|
||||
}
|
||||
}
|
||||
}
|
@ -49,7 +49,9 @@ o:depends({ [option_name("protocol")] = "_iface" })
|
||||
|
||||
local nodes_table = {}
|
||||
local balancers_table = {}
|
||||
local fallback_table = {}
|
||||
local iface_table = {}
|
||||
local is_balancer = nil
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
if e.node_type == "normal" then
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
@ -63,6 +65,15 @@ for k, e in ipairs(api.get_valid_nodes()) do
|
||||
id = e[".name"],
|
||||
remark = e["remark"]
|
||||
}
|
||||
if e[".name"] ~= arg[1] then
|
||||
fallback_table[#fallback_table + 1] = {
|
||||
id = e[".name"],
|
||||
remark = e["remark"],
|
||||
fallback = e["fallback_node"]
|
||||
}
|
||||
else
|
||||
is_balancer = true
|
||||
end
|
||||
end
|
||||
if e.protocol == "_iface" then
|
||||
iface_table[#iface_table + 1] = {
|
||||
@ -90,23 +101,35 @@ for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end
|
||||
local o = s:option(ListValue, option_name("balancingStrategy"), translate("Balancing Strategy"))
|
||||
o:depends({ [option_name("protocol")] = "_balancing" })
|
||||
o:value("random")
|
||||
o:value("roundRobin")
|
||||
o:value("leastPing")
|
||||
o:value("leastLoad")
|
||||
o.default = "leastLoad"
|
||||
o.default = "leastPing"
|
||||
|
||||
-- Fallback Node
|
||||
if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.10") then
|
||||
local o = s:option(ListValue, option_name("fallback_node"), translate("Fallback Node"))
|
||||
o:depends({ [option_name("protocol")] = "_balancing" })
|
||||
o:depends({ [option_name("balancingStrategy")] = "leastPing" })
|
||||
o:value("",translate("Null"))
|
||||
o.default = ""
|
||||
local function check_fallback_chain(fb)
|
||||
for k, v in pairs(fallback_table) do
|
||||
if v.fallback == fb then
|
||||
fallback_table[k] = nil
|
||||
check_fallback_chain(v.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- 检查fallback链,去掉会形成闭环的balancer节点
|
||||
if is_balancer then
|
||||
check_fallback_chain(arg[1])
|
||||
end
|
||||
for k, v in pairs(fallback_table) do o:value(v.id, v.remark) end
|
||||
for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end
|
||||
end
|
||||
|
||||
-- 探测地址
|
||||
local o = s:option(Flag, option_name("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL."))
|
||||
o:depends({ [option_name("balancingStrategy")] = "leastPing" })
|
||||
o:depends({ [option_name("balancingStrategy")] = "leastLoad" })
|
||||
|
||||
local o = s:option(Value, option_name("probeUrl"), translate("Probe URL"))
|
||||
o:depends({ [option_name("useCustomProbeUrl")] = true })
|
||||
@ -116,7 +139,6 @@ o.description = translate("The URL used to detect the connection status.")
|
||||
-- 探测间隔
|
||||
local o = s:option(Value, option_name("probeInterval"), translate("Probe Interval"))
|
||||
o:depends({ [option_name("balancingStrategy")] = "leastPing" })
|
||||
o:depends({ [option_name("balancingStrategy")] = "leastLoad" })
|
||||
o.default = "1m"
|
||||
o.description = translate("The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.")
|
||||
|
||||
|
@ -564,6 +564,8 @@ function gen_config(var)
|
||||
|
||||
if node_id then
|
||||
local node = uci:get_all(appname, node_id)
|
||||
local balancers = {}
|
||||
local rules = {}
|
||||
if node then
|
||||
if server_host and server_port then
|
||||
node.address = server_host
|
||||
@ -682,25 +684,32 @@ function gen_config(var)
|
||||
end
|
||||
if is_new_node then
|
||||
local fallback_node = uci:get_all(appname, fallback_node_id)
|
||||
local outbound = gen_outbound(flag, fallback_node, fallback_node_id, { fragment = xray_settings.fragment == "1" or nil })
|
||||
if outbound then
|
||||
table.insert(outbounds, outbound)
|
||||
if fallback_node.protocol ~= "_balancing" then
|
||||
local outbound = gen_outbound(flag, fallback_node, fallback_node_id, { fragment = xray_settings.fragment == "1" or nil })
|
||||
if outbound then
|
||||
table.insert(outbounds, outbound)
|
||||
else
|
||||
fallback_node_id = nil
|
||||
end
|
||||
else
|
||||
fallback_node_id = nil
|
||||
local valid = gen_balancer(fallback_node)
|
||||
if not valid then
|
||||
fallback_node_id = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local balancer, rule
|
||||
local valid = nil
|
||||
if #valid_nodes > 0 then
|
||||
local balancerTag = get_balancer_tag(_node[".name"])
|
||||
balancer = {
|
||||
table.insert(balancers, {
|
||||
tag = balancerTag,
|
||||
selector = valid_nodes,
|
||||
fallbackTag = fallback_node_id,
|
||||
strategy = { type = _node.balancingStrategy or "random" }
|
||||
}
|
||||
if _node.balancingStrategy == "leastPing" or _node.balancingStrategy == "leastLoad" then
|
||||
})
|
||||
if _node.balancingStrategy == "leastPing" then
|
||||
if not observatory then
|
||||
observatory = {
|
||||
subjectSelector = { "blc-" },
|
||||
@ -717,13 +726,10 @@ function gen_config(var)
|
||||
tag = loopbackTag,
|
||||
settings = { inboundTag = inboundTag }
|
||||
})
|
||||
rule = {
|
||||
type = "field",
|
||||
inboundTag = { inboundTag },
|
||||
balancerTag = balancerTag
|
||||
}
|
||||
table.insert(rules, { type = "field", inboundTag = { inboundTag }, balancerTag = balancerTag })
|
||||
valid = true
|
||||
end
|
||||
return balancer, rule
|
||||
return valid
|
||||
end
|
||||
|
||||
local function set_outbound_detour(node, outbound, outbounds_table, shunt_rule_name)
|
||||
@ -755,9 +761,6 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
if node.protocol == "_shunt" then
|
||||
local rules = {}
|
||||
local balancers = {}
|
||||
|
||||
local preproxy_enabled = node.preproxy_enabled == "1"
|
||||
local preproxy_tag = "main"
|
||||
local preproxy_node_id = node["main_node"]
|
||||
@ -793,11 +796,8 @@ function gen_config(var)
|
||||
end
|
||||
elseif preproxy_node and preproxy_node.protocol == "_balancing" then
|
||||
preproxy_is_balancer = true
|
||||
local preproxy_balancer, preproxy_rule = gen_balancer(preproxy_node, preproxy_tag)
|
||||
if preproxy_balancer and preproxy_rule then
|
||||
table.insert(balancers, preproxy_balancer)
|
||||
table.insert(rules, preproxy_rule)
|
||||
else
|
||||
local valid = gen_balancer(preproxy_node, preproxy_tag)
|
||||
if not valid then
|
||||
preproxy_enabled = false
|
||||
end
|
||||
end
|
||||
@ -913,11 +913,9 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if is_new_balancer then
|
||||
local balancer, rule = gen_balancer(_node)
|
||||
if balancer then
|
||||
table.insert(balancers, balancer)
|
||||
table.insert(rules, rule)
|
||||
rule_balancerTag = balancer.tag
|
||||
local valid = gen_balancer(_node)
|
||||
if valid then
|
||||
rule_balancerTag = get_balancer_tag(_node_id)
|
||||
end
|
||||
end
|
||||
elseif _node.protocol == "_iface" then
|
||||
@ -1043,13 +1041,13 @@ function gen_config(var)
|
||||
}
|
||||
elseif node.protocol == "_balancing" then
|
||||
if node.balancing_node then
|
||||
local balancer, rule = gen_balancer(node)
|
||||
local valid = gen_balancer(node)
|
||||
if valid then
|
||||
table.insert(rules, { type = "field", network = "tcp,udp", balancerTag = get_balancer_tag(node_id) })
|
||||
end
|
||||
routing = {
|
||||
balancers = { balancer },
|
||||
rules = {
|
||||
{ type = "field", network = "tcp,udp", balancerTag = balancer.tag },
|
||||
rule
|
||||
}
|
||||
balancers = balancers,
|
||||
rules = rules
|
||||
}
|
||||
end
|
||||
elseif node.protocol == "_iface" then
|
||||
|