├── .github
└── ISSUE_TEMPLATE.md
├── LICENSE
├── README.md
├── batteryLogger.sh
├── clusterboard-RTL8211E-led-ctrl.sh
├── install-arduino-ide.sh
├── install-mate-gnome-online-accounts.sh
├── install-rpimonitor.sh
├── pine64-SYSLED-heartbeat.sh
├── pine64-battery-colour.sh
├── pine64-battery.sh
├── pine64-cpu-temp.py
├── pine64-diagnostics.sh
├── pine64-fan-control.py
├── pine64-gpio-number.py
├── pinebook
├── asound.state
├── fix-battery-detection.sh
├── fixed-wifi-mac.sh
├── headphone_detect.sh
├── no-speaker-fix.sh
├── pinebook-lcd-brightness-gpio.service
├── pinebook_lcd-brightness.sh
├── pinebook_speaker.sh
├── pinebook_touchpad.sh
├── restart-nm-applet.sh
└── touchpadTamer.py
├── pinephone
└── manjaro
│ ├── batteryChecker.service
│ ├── batteryChecker.sh
│ ├── fix-no-backlight.service
│ ├── fix-no-backlight.sh
│ ├── readme.md
│ └── wifi-power-management.sh
├── restart-nm-applet.sh
├── testing
├── gpio-input-test.sh
└── quickcputest.sh
├── updatePlatformScripts.sh
└── utility
└── tar-and-base64.sh
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Please make sure you've ticked off these boxes before submitting your issue -- thank you!
2 |
3 | Where the issue is in regards to a fault / error:
4 | - [ ] Detailed exactly which script is having issues
5 | - [ ] Provided operating system details (debian, ubuntu, kernel version, etc)
6 | - [ ] Detailed a way to repeatedly reproduce the issue
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # pine64-scripts
2 | Utility scripts for the pine64
3 |
--------------------------------------------------------------------------------
/batteryLogger.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | UPDATE_INTERVAL=60
4 |
5 | function timer()
6 | {
7 | local stime=$1
8 | etime=$(date '+%s')
9 |
10 | if [[ -z "$stime" ]]; then stime=$etime; fi
11 |
12 | dt=$((etime - stime))
13 | ds=$((dt % 60))
14 | dm=$(((dt / 60) % 60))
15 | dh=$((dt / 3600))
16 | ELAPSED_TIME=$(printf '%d:%02d:%02d' $dh $dm $ds)
17 | }
18 |
19 |
20 | if [[ -e ~/batteryHistory.log || -e ~/battlog.csv ]]
21 | then
22 | while true; do
23 | read -p "Do you wish to delete previous battery logs? " yn
24 |
25 | case $yn in
26 | [Yy]* ) rm ~/batteryHistory.log ~/battlog.csv; echo "date,time,voltage,current (ma),soc (%),elapsed time (seconds)" > ~/battlog.csv; break;;
27 | [Nn]* ) echo "Keeping existing logs"; break;;
28 | esac
29 | done
30 | # exit 1
31 | fi
32 |
33 | START_TIME=$(date +%s)
34 | echo "-------------------------------------------------------------" | tee -a ~/batteryHistory.log
35 | echo "| date | time | Voltage | Current | SoC | Elapsed |" | tee -a ~/batteryHistory.log
36 | echo "| | | | (mA) | (%) | Time |" | tee -a ~/batteryHistory.log
37 | echo "--------------------------------------------------|----------" | tee -a ~/batteryHistory.log
38 | # 2017-03-28 | 10-03-09 | 4.19 | 1 | 100^C
39 |
40 | #echo "date/time voltage current(mA) SoC (%)"
41 |
42 | while [ 1 ]
43 | do
44 | DATE=$(date +%Y-%m-%d)
45 | TIME=$(date +%H:%M:%S)
46 | BATT_VOLTAGE=$(awk '{printf ("%0.2f",$1/1000000); }' > ~/battlog.csv
54 | sync
55 | sleep $UPDATE_INTERVAL
56 | done
57 |
--------------------------------------------------------------------------------
/clusterboard-RTL8211E-led-ctrl.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Thanks to joncostello from the pine64 for the inspiration for writing this
4 | # https://forum.pine64.org/showthread.php?tid=9780
5 |
6 | MODE="none"
7 | QUIET=0
8 |
9 | LedsOff() {
10 | # set to extension page, extension Page44
11 | phytool write eth0/0/31 0x0007
12 | phytool write eth0/0/30 0x2c
13 | # link rx/tx steady mode, no link up indicator
14 | phytool write eth0/0/0x1a 0x0000
15 | phytool write eth0/0/0x1c 0x0000
16 | # switch to the PHY’s Page
17 | phytool write eth0/0/31 0x0000
18 | } # LedsOff
19 |
20 | LedsOn() {
21 | # set to extension page, extension Page44
22 | phytool write eth0/0/31 0x0007
23 | phytool write eth0/0/30 0x2c
24 | # link rx/tx blinking mode, re-enable link up indicator
25 | phytool write eth0/0/0x1a 0x00d1
26 | phytool write eth0/0/0x1c 0x9770
27 | # switch to the PHY’s Page
28 | phytool write eth0/0/31 0x0000
29 | } # LedsOn
30 |
31 | Main() {
32 | ParseOptions "$@"
33 |
34 | if [ $# -eq 0 ] || [ ${MODE} == "none" ]; then
35 | DisplayUsage
36 | exit 1
37 | fi
38 |
39 | CheckRootPriv
40 | CheckDependencies
41 |
42 | case "${MODE}" in
43 | enable_leds)
44 | if [ $QUIET != 1 ]; then echo "Disabling NIC Leds..."; fi
45 | LedsOff
46 | exit 0
47 | ;;
48 | disable_leds)
49 | if [ $QUIET != 1 ]; then echo "Enabling NIC Leds..."; fi
50 | LedsOn
51 | exit 0
52 | ;;
53 | show_regs)
54 | LACR=$(phytool read eth0/0/0x1a)
55 | LCR=$(phytool read eth0/0/0x1c)
56 |
57 | echo "LED Action Control Register (LACR) = ${LACR}"
58 | echo "LED Control Register (LCR) = ${LCR}"
59 | exit 0
60 | ;;
61 | esac
62 |
63 | exit 1
64 | } # Main
65 |
66 | ParseOptions() {
67 | while getopts ':hHedsq' opt ; do
68 | case ${opt} in
69 | h|H)
70 | DisplayUsage
71 | exit 0
72 | ;;
73 | e)
74 | MODE="enable_leds"
75 | ;;
76 | d)
77 | MODE="disable_leds"
78 | ;;
79 | s)
80 | MODE="show_regs"
81 | ;;
82 | q)
83 | QUIET=1
84 | ;;
85 | \?)
86 | echo "Invalid option: ${OPTARG}" 1>&2
87 | exit 1
88 | ;;
89 | :)
90 | echo "Invalid option: ${OPTARG} requires an argument." 1>&2
91 | exit 1
92 | ;;
93 | esac
94 | done
95 | shift $((OPTIND -1))
96 | } # ParseOptions
97 |
98 | DisplayUsage() {
99 | echo "Usage: ${0##*/} [-h] [-e] [-d] [-s] [-q]"
100 | echo "############################################################################"
101 | echo "Use clusterboard-RTL8211E-led-ctrl for the following tasks:"
102 | echo " -e enables the RTL8211E (ethernet transceiver) leds"
103 | echo " -d disables the RTL8211E (ethernet transceiver) leds"
104 | echo " -s shows the current RTL8211E LACR/LCR register values"
105 | echo " -q hides output from enable/disable commands"
106 | echo " -h displays this help screen"
107 | echo "############################################################################"
108 | } # DisplayUsage
109 |
110 | CheckRootPriv() {
111 | if [ "$(id -u)" != "0" ]; then
112 | echo -ne "This script must be executed as root. Exiting\n" >&2
113 | exit 1
114 | fi
115 | } # CheckRootPriv
116 |
117 | CheckDependencies() {
118 | command -v phytool >/dev/null 2>&1 || { echo >&2 "phytool (https://github.com/wkz/phytool) is required but not detected. Aborting."; exit 1; }
119 | } # CheckDependencies
120 |
121 | Main "$@"
122 |
--------------------------------------------------------------------------------
/install-arduino-ide.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ARDUINO_IDE_VER="1.8.10"
4 | ARDUINO_IDE_URL="https://downloads.arduino.cc/arduino-1.8.10-linuxarm.tar.xz"
5 |
6 | #check for root priv
7 | if [ "$(id -u)" != "0" ]; then
8 | echo -ne "This script must be executed as root. Exiting\n" >&2
9 | exit 1
10 | fi
11 |
12 | #check how being elevated
13 | if [ -z "$SUDO_COMMAND" ]; then
14 | echo -ne "This script relies on being run via sudo for some operations.\n"
15 | echo -ne "Expect things to not work, or to have to do some extra stuff\n"
16 | echo -ne "after running it if you continue.\n"
17 | echo -ne "\nYou have been warned!\n\n"
18 | fi
19 |
20 | main() {
21 | downloadPackage
22 | unpackIDE
23 | armhfEnable
24 | installDependencies
25 | fixGTK
26 | fixSerialMonitor
27 | fixPermissions
28 | desktopIcon
29 |
30 | #completion messages
31 | echo -ne "\nYou should now be able to see an 'Arduino' icon on your desktop ready"
32 | echo -ne "\nfor you to use! Please note that the first launch will take a while,"
33 | echo -ne "\nbut it will be pretty quick after that first run."
34 |
35 | #notify user that they will need to log out and in again before will be able to load to a device to allow addition to dialout group to take effect
36 | if [[ -n "$SUDO_USER" ]]; then
37 | echo -ne "\n\nYou will need to log out and back in again to allow the addition"
38 | echo -ne "\nof your username to the 'dialout' group to take effect. Failure"
39 | echo -ne "\nto do so will prevent you from being able to upload to any"
40 | echo -ne "\nserial programmed Arduino compatiable devices."
41 | fi
42 |
43 | #notify user they can also delete the downloaded arduino archive
44 | echo -ne "\n\nAdditionally, you can delete /tmp/arduino-${ARDUINO_IDE_VER}-linuxarm.tar.xz"
45 | echo -ne "\nif you wish to as it is no longer needed.\n"
46 | }
47 |
48 | #download and unpack
49 | downloadPackage() {
50 | echo -ne "Arduino IDE ${ARDUINO_IDE_VER} Install Script\n\n"
51 | echo -ne "Downloading Arduino IDE ${ARDUINO_IDE_VER} ... "
52 | wget -q -O "/tmp/arduino-linuxarm.tar.xz" ${ARDUINO_IDE_URL} 2>&1
53 | if [ $? -ne 0 ]; then
54 | echo -ne "fail\n"
55 | echo -ne "Unable to successfully download package... please try again!\n\n"
56 | exit 1
57 | else
58 | echo -ne "done\n"
59 | fi
60 | }
61 |
62 | unpackIDE() {
63 | echo -ne "Unpacking to /opt/arduino-${ARDUINO_IDE_VER}/ ... "
64 | tar xf /tmp/arduino-linuxarm.tar.xz --directory /opt/ > /dev/null 2>&1 || { echo "Fail! Exiting script!"; exit 1; }
65 | echo -ne "done\n"
66 | }
67 |
68 | #enable armhf packages support
69 | armhfEnable() {
70 | echo -ne "Enable armhf package support and update software repository ... "
71 | dpkg --add-architecture armhf
72 | apt-get -qq update
73 | echo -ne "done\n"
74 | }
75 |
76 | #install required armhf dependencies
77 | installDependencies() {
78 | echo -ne "Installing required dependencies (this may take several minutes) ... "
79 | apt-get -f -qq -y install libxtst6:armhf > /dev/null 2>&1
80 | apt-get -f -qq -y install libxrender1:armhf > /dev/null 2>&1
81 | apt-get -f -qq -y install libxi6:armhf > /dev/null 2>&1
82 | apt-get -f -qq -y install openjdk-8-jre:armhf > /dev/null 2>&1
83 | echo -ne " done\n"
84 | }
85 |
86 | #get rid of GTK errors
87 | fixGTK() {
88 | echo -ne "Install GTK2 engine and required theme ... "
89 | apt-get -f -qq -y install gtk2-engines:armhf gtk2-engines-murrine:armhf > /dev/null 2>&1
90 | echo -ne "done\n"
91 | }
92 |
93 | #fix serial monitor error caused by wrong ~/.jssc/linux/libjSSC-2.8_armsf.so
94 | fixSerialMonitor() {
95 | if [[ -n "$SUDO_USER" ]] && [[ -f "/opt/arduino-${ARDUINO_IDE_VER}/lib/jssc-2.8.0-arduino4.jar" ]]; then
96 | echo -ne "Fixing up serial monitor bug ... "
97 | #rename old files if present
98 | [ -f "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armsf.so" ] && mv "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armsf.so" "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armsf.so.old"
99 | [ -f "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armhf.so" ] && mv "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armhf.so" "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armhf.so.old"
100 |
101 | #create directory if it doesn't actually exist, which it shouldn't on a clean system
102 | [ ! -d "/home/$SUDO_USER/.jssc/linux" ] && mkdir -p "/home/$SUDO_USER/.jssc/linux"
103 |
104 | unzip -p "/opt/arduino-${ARDUINO_IDE_VER}/lib/jssc-2.8.0-arduino4.jar" "libs/linux/libjSSC-2.8_armhf.so" > "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armhf.so"
105 | ln -s "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armhf.so" "/home/$SUDO_USER/.jssc/linux/libjSSC-2.8_armsf.so"
106 | echo -ne "done\n"
107 | else
108 | echo -ne "Unable to apply serial monitor bug fix as not sudo or file missing!\n"
109 | echo -ne "See post #21 of https://forum.arduino.cc/index.php?topic=400808.15\n"
110 | fi
111 | }
112 |
113 | #add user to dialout group
114 | fixPermissions() {
115 | if [[ -n "$SUDO_USER" ]]; then
116 | echo -ne "Add user to the dialout group ... "
117 | usermod -aG dialout "$SUDO_USER"
118 | echo -ne "done\n"
119 | else
120 | echo -ne "Not running via sudo, can't determine username to add to dialout group!\n"
121 | fi
122 | }
123 |
124 | #add desktop icon using provided install script
125 | desktopIcon() {
126 | if [[ -n "$SUDO_USER" ]]; then
127 | echo -ne "Adding desktop shortcut, menu item and file associations for Arduino IDE ... "
128 | su "$SUDO_USER" /opt/arduino-${ARDUINO_IDE_VER}/install.sh > /dev/null 2>&1
129 | echo -ne "done\n"
130 | else
131 | echo -ne "Not running as sudo, can't run install.sh as normal user\n"
132 | echo -ne "So you'll need to run /opt/arduino-${ARDUINO_IDE_VER}/install.sh yourself!\n"
133 | fi
134 | }
135 |
136 | main "$@"
137 |
--------------------------------------------------------------------------------
/install-mate-gnome-online-accounts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Installs and configures the GNOME Control Centre on Ubuntu Mate to
3 | # give access to the Online Services module
4 | #
5 | # GPL v3 licensed
6 | # Written 2017 Peter Feerick
7 |
8 | if [ "$(id -u)" != "0" ]; then
9 | echo "This script must be executed as root. Exiting" >&2
10 | exit 1
11 | fi
12 |
13 | echo -en "GNOME Online Accounts installer\n\n"
14 |
15 | echo -ne "Refreshing software update repositories ... "
16 | apt-get update >/dev/null 2>&1
17 | echo -ne "done!\n"
18 |
19 | echo -ne "Installing GNOME Online Accounts and dependencies ... "
20 | apt-get -f -y install gnome-control-center gnome-online-accounts >/dev/null 2>&1
21 | echo -ne "done!\n"
22 |
23 | echo -ne "Adding menu entry to Applications -> System Tools ... "
24 | mkdir -p ~/.local/share/applications/
25 | cp /usr/share/applications/gnome-control-center.desktop ~/.local/share/applications/
26 | sed -i '/^OnlyShowIn/d' ~/.local/share/applications/gnome-control-center.desktop
27 | sed -i 's/^Exec.*/Exec=env XDG_CURRENT_DESKTOP=GNOME gnome-control-center --overview/' ~/.local/share/applications/gnome-control-center.desktop
28 | sed -i 's/^Name=Settings/Name=GNOME Control Center/' ~/.local/share/applications/gnome-control-center.desktop
29 | echo -ne "done!\n"
30 |
31 | echo -ne "\nYou can now launch the GNOME Control Center from Applications -> System Tools.\n"
32 | echo -ne "This will give you access to all the settings modules, including Online Accounts.\n\n"
33 |
--------------------------------------------------------------------------------
/install-rpimonitor.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Install rpimonitor on a pine64 running ubuntu (may work for debian also)
4 | #
5 | # Run latest version directly from github when logged in as root / sudo with
6 | # wget -q -O - https://raw.githubusercontent.com/pfeerick/pine64-scripts/master/install-rpimonitor.sh | /bin/bash
7 | #
8 | # Original code lifted from http://kaiser-edv.de/tmp/4U4tkD/install-rpi-monitor-for-a64.sh
9 | # Original code written by tkaiser, as well as assuggestions for a deriverative work
10 | #
11 | # This modification written by pfeerick
12 |
13 | if [ "$(id -u)" != "0" ]; then
14 | echo "This script must be executed as root. Exiting" >&2
15 | exit 1
16 | fi
17 |
18 | useEncodedPublicKey()
19 | {
20 | echo -e "\nUsing backup copy of public key for Armbian package list"
21 | cd /tmp && echo "LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tClZlcnNpb246IFNL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3JPWU9YZWtXbGN3
75 | NWxFaVlGY2NrdWtOcXEKRnYvQ1hoK0JaRmxRVDRERHZKbFkwL0tRRkZLb2dRPT0KPUkvUDgKLS0t
76 | LS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQo=" | base64 --decode > keyfile
77 |
78 | if [ -f /tmp/keyfile ]; then
79 | apt-key add /tmp/keyfile
80 | local keyAddState=$?
81 |
82 | rm /tmp/keyfile
83 |
84 | if [ $keyAddState -ne 0 ]; then
85 | echo -e "\033[0;31m\nUnable to add backup public key... exiting\033[0m"
86 |
87 | if [ -f /etc/apt/sources.list.d/armbian.list ]; then
88 | #remove if not Armbian
89 | if [ ! -f /etc/armbian-release ]; then rm /etc/apt/sources.list.d/armbian.list; fi
90 | fi
91 |
92 | exit 2
93 | fi
94 | else
95 | echo -e "\033[0;31m\nUnable to use provided backup public key... exiting\033[0m"
96 |
97 | if [ -f /etc/apt/sources.list.d/armbian.list ]; then
98 | #remove if not Armbian
99 | if [ ! -f /etc/armbian-release ]; then rm /etc/apt/sources.list.d/armbian.list; fi
100 | fi
101 |
102 | exit 1
103 | fi
104 | } #useEncodedPublicKey
105 |
106 | PatchRPiMonitor_for_sun50iw1p1()
107 | {
108 | echo -e "\nNow patching RPi-Monitor to deal correctly with A64"
109 | cd /etc/rpimonitor/ && echo "H4sIAGQt4VYAA+07a3fbNpb57F+B43ZG8kamRMmyvV7b56RJmmSnaX3yaGfPPDwQCUmsKVIDkLbV
110 | Jv9pf8P+sr33AiBBirJsN92ze5ZoY4l4XNwX7gtUyDPuBWkyffL7tQG0o6Mj+oRW/6Tv/vDwcDwY
111 | jQYj6B8ORsPxEzbsiyzoy2W0SJMoS2U/E4tlzDPRvxVJxOMvgneuMi4ZeyLTNLtr3rbx/6Pt92Bp
112 | vaGADw8PNsh/NDwa+Vr+44MxfD4Z+KPxwfAJG3xpRJra/3P5f/WF2g78x/508YaJ20zyIIvShKEu
113 | RbNccnyCYfiffZhHii25zFg6Zdl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n4tYRbkqOeMPPnfcnVwqnO4KGe70dX0zZFyjNTPG
194 | bGedElfXMKRAM9/nt8tj//ZykkK8hg/7+oeHmOsf+P3iofwGyTKAlSnuo3aaqWgmwjnhw00nvJG8
195 | Q3Oc0oCEVHY3UXYdySzncR9rd4vy8xIt7KBfA9CE9GGzAh02YXZkDpE29eQXnLH7oGeWXupxOPRg
196 | O+twmrA8asbyqAnL4wqW5I+csUZTlAYeGaDLSQ7JVXaJaz3/sA9B1sLVruNG5I6bkTs2JqhSkbAV
197 | SeOHnl983DRONRXACaspm+bQhat/5r65sfsd2HtQt10fMln4HPSYuSdGh8FGEH8MoO94sPcUDu/T
198 | xqXj9aXjey71G9b61cV3EjM82wWelMHVCTudnO+CLSZoFbcNnbuvXv9y2p+csz8mE7X8t2450RE+
199 | ztvbvXPX0dnuK+NuqhvWnRHCcjZ8pquYiDEaI7WOLTmb2ioKw6pTXVtmZ+9uUB3jbh2ju2meVaFL
200 | tAOb9WjUqEcQnaFA/+s/4cNK09gkpoWJ/44Hvco7Gb3xoHfUpCDPTXyIobRAwCVU154A6KNmwH5v
201 | uFcp3/2uBOysVwRrRxc1nvX1qxhqKUSo4KlJKA0A9KWYr6O47ROHNHG8feLozMSCW2ce1ELgrQvG
202 | Tuy0dfJh1UdsnX9UeLutU4+rfv+O+WvXVsQbc9FG0vPxha4Hgxi7IMaPAuFXYPgPB1IRnoGFVoi0
203 | kZE6si4Yx73fAHWFV1BnwwdDIB0xOJUGUj0SzmOwMMpkcLBpJuuCKXgYQ2ykbCC9gMfHgnK11oDT
204 | 6Xj3x98A6FEyco6mVR3XOD8e2D2wqa5e+bTi1+IXEpBg4bsHYLfhRJyw0ZjeOD1hR2P2+QFgh+tg
205 | Jb44uQtQ7luJbFvb2ta2trWtbW1rW9va1ra2ta1tbWtb29rWtra1rW1ta1vb2ta2trWtbW1rW9va
206 | 1ra2ta1tbWvbfdp/A41zs94AeAAA" | base64 --decode | tar xzf -
207 |
208 | which systemctl >/dev/null 2>&1
209 | case $? in
210 | 0)
211 | # Jessie
212 | systemctl restart rpimonitor >/dev/null 2>&1
213 | ;;
214 | *)
215 | # Wheezy|Trusty
216 | /etc/init.d/rpimonitor stop >/dev/null 2>&1
217 | /etc/init.d/rpimonitor start >/dev/null 2>&1
218 | ;;
219 | esac
220 | } # PatchRPiMonitor_for_sun50iw1p1
221 |
222 | cleanupPackageLists()
223 | {
224 | echo -e "\nCleaning up package lists"
225 |
226 | if [ -f /etc/apt/sources.list.d/armbian.list ]; then
227 | #remove if not Armbian
228 | if [ ! -f /etc/armbian-release ]; then
229 | rm /etc/apt/sources.list.d/armbian.list
230 | apt-key del 9F0E78D5 >/dev/null 2>&1
231 | apt-get update
232 | fi
233 | fi
234 | } # cleanupPackageLists
235 |
236 | echo -e "$(date) Start RPi-Monitor installation\n"
237 |
238 | echo -e "Checking for dpkg lock\c"
239 | while true ; do
240 | fuser /var/lib/dpkg/lock >/dev/null 2>&1 || break
241 | sleep 3
242 | echo -e ".\c"
243 | done
244 |
245 | echo -e "\nAdding Armbian package list"
246 | if [ ! -f /etc/apt/sources.list.d/armbian.list ]; then
247 | echo 'deb http://apt.armbian.com xenial main utils xenial-desktop' > \
248 | /etc/apt/sources.list.d/armbian.list
249 |
250 | apt-key adv --keyserver keys.gnupg.net --recv-keys 0x93D6889F9F0E78D5 >/dev/null 2>&1
251 |
252 | if [ $? -ne 0 ]; then
253 | useEncodedPublicKey
254 | fi
255 | fi
256 |
257 | echo -e "\nUpdating package lists"
258 | apt-get update
259 |
260 | echo -e "\nInstalling rpimonitor (this may take several minutes)..."
261 | apt-get -f -qq -y install rpimonitor
262 | /usr/share/rpimonitor/scripts/updatePackagesStatus.pl &
263 |
264 | cleanupPackageLists
265 |
266 | PatchRPiMonitor_for_sun50iw1p1
267 |
268 | echo -e "\n$(date) Finished RPi-Monitor installation"
269 | echo -e " \nNow you're able to enjoy RPi-Monitor at http://$((ifconfig -a) | sed -n '/inet addr/s/.*addr.\([^ ]*\) .*/\1/p' | head -1):8888"
270 |
--------------------------------------------------------------------------------
/pine64-SYSLED-heartbeat.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function openGPIO
4 | {
5 | #test if GPIO sysfs entry exists, create if necessary
6 | if [ ! -e "/sys/class/gpio/gpio359" ]; then
7 | # echo "DEBUG: export 359"
8 | echo 359 > "/sys/class/gpio/export"
9 | sleep 0.1
10 | fi
11 |
12 | #test direction is set correctly, set if necessary
13 | GPIO_359_DIRECTION=$( /sys/class/gpio/gpio359/direction
18 | sleep 0.1
19 | fi
20 | }
21 |
22 | function closeGPIO
23 | {
24 | #turn off, unexport GPIO sysfs entry, and quit nicely
25 | echo 1 > "/sys/class/gpio/gpio359/value"
26 | echo 359 > "/sys/class/gpio/unexport"
27 | }
28 |
29 | function cleanup
30 | {
31 | closeGPIO
32 | exit 0
33 | }
34 |
35 |
36 | #unexport and exit nicely if Ctrl-C pressed, SIGTERM, etc sent
37 | trap cleanup SIGHUP SIGINT SIGTERM
38 |
39 | openGPIO
40 |
41 | #absorb likely error from first access to GPIO value
42 | echo 0 | tee "/sys/class/gpio/gpio359/value" > /dev/null 2>&1
43 |
44 | #momentary pause to let udev do its magic
45 | sleep 0.1
46 |
47 | #main loop
48 | while true
49 | do
50 | echo 0 > "/sys/class/gpio/gpio359/value" #on
51 | sleep 0.1s
52 | echo 1 > "/sys/class/gpio/gpio359/value" #off
53 | sleep 0.1s
54 | echo 0 > "/sys/class/gpio/gpio359/value" #on
55 | sleep 0.1s
56 | echo 1 > "/sys/class/gpio/gpio359/value" #off
57 | sleep 0.1s
58 | echo 1 > "/sys/class/gpio/gpio359/value" #off
59 | sleep 9.7s
60 | done
61 |
62 | exit 0
63 |
64 |
--------------------------------------------------------------------------------
/pine64-battery-colour.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | SWITCH="\033["
4 | NORMAL="${SWITCH}0m"
5 | RED="${SWITCH}1;31m"
6 | GREEN="${SWITCH}1;32m"
7 | YELLOW="${SWITCH}1;33m"
8 | PURPLE="${SWITCH}1;35m"
9 | BLUE="${SWITCH}1;34m"
10 | CYAN="${SWITCH}1;36m"
11 |
12 | if [ -e "/sys/class/power_supply/battery" ]; then
13 | BATT_PATH="/sys/class/power_supply/battery"
14 | else
15 | BATT_PATH="/sys/class/power_supply/axp20x-battery"
16 | fi
17 |
18 | BATT_PRESENT=$(<${BATT_PATH}/present)
19 |
20 | if [ "$BATT_PRESENT" = "1" ]; then
21 | BATT_STATUS=$(<${BATT_PATH}/status)
22 |
23 | if command -v "bc" >/dev/null 2>&1 ; then
24 | BATT_VOLTAGE=$(<${BATT_PATH}/voltage_now)
25 | BATT_VOLTAGE=$(echo " (($BATT_VOLTAGE/10000)*0.01 ) "|bc)
26 | else
27 | BATT_VOLTAGE=$(awk '{printf ("%0.2f",$1/1000000); }' <${BATT_PATH}/voltage_now)
28 | fi
29 |
30 | BATT_CURRENT=$(<${BATT_PATH}/current_now)
31 | ((BATT_CURRENT = BATT_CURRENT / 1000))
32 | BATT_CAPACITY=$(<${BATT_PATH}/capacity)
33 | BATT_HEALTH=$(<${BATT_PATH}/health)
34 |
35 | echo -e "${PURPLE}Pine64${NORMAL} reports battery ${GREEN}detected!${NORMAL}"
36 | echo -e "${YELLOW}Status:${NORMAL}" $BATT_STATUS
37 | echo -e "${YELLOW}Voltage:${NORMAL}" $BATT_VOLTAGE"v"
38 | echo -e "${YELLOW}Current:${NORMAL}" $BATT_CURRENT"ma"
39 | echo -e "${YELLOW}Capacity:${NORMAL}" $BATT_CAPACITY"%"
40 | echo -e "${YELLOW}Health:${NORMAL}" $BATT_HEALTH
41 | else
42 | echo -e "${PURPLE}Pine64${NORMAL} reports battery ${RED}not detected!${NORMAL}"
43 | fi
44 |
--------------------------------------------------------------------------------
/pine64-battery.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ -e "/sys/class/power_supply/battery" ]; then
4 | BATT_PATH="/sys/class/power_supply/battery"
5 | else
6 | BATT_PATH="/sys/class/power_supply/axp20x-battery"
7 | fi
8 |
9 | BATT_PRESENT=$(<${BATT_PATH}/present)
10 |
11 | if [ "$BATT_PRESENT" = "1" ]; then
12 | BATT_STATUS=$(<${BATT_PATH}/status)
13 |
14 | if command -v "bc" >/dev/null 2>&1 ; then
15 | BATT_VOLTAGE=$(<${BATT_PATH}/voltage_now)
16 | BATT_VOLTAGE=$(echo " (($BATT_VOLTAGE/10000)*0.01 ) "|bc)
17 | else
18 | BATT_VOLTAGE=$(awk '{printf ("%0.2f",$1/1000000); }' <${BATT_PATH}/voltage_now)
19 | fi
20 |
21 | BATT_CURRENT=$(<${BATT_PATH}/current_now)
22 | ((BATT_CURRENT = BATT_CURRENT / 1000))
23 | BATT_CAPACITY=$(<${BATT_PATH}/capacity)
24 | BATT_HEALTH=$(<${BATT_PATH}/health)
25 |
26 | echo "Pine64 reports battery detected!"
27 | echo "Status:" $BATT_STATUS
28 | echo "Voltage:" $BATT_VOLTAGE"v"
29 | echo "Current:" $BATT_CURRENT"ma"
30 | echo "Capacity:" $BATT_CAPACITY"%"
31 | echo "Health:" $BATT_HEALTH
32 | else
33 | echo "Pine64 reports battery not detected!"
34 | fi
35 |
--------------------------------------------------------------------------------
/pine64-cpu-temp.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | from __future__ import print_function
3 |
4 | TEMP_SOURCE = "/sys/devices/virtual/thermal/thermal_zone0/temp" # pine64
5 |
6 | F = open(TEMP_SOURCE, "r")
7 | CPU_TEMP = int(F.read())
8 | F.close()
9 |
10 | print("{:.2f}\u00b0C".format(CPU_TEMP/1000.0))
11 |
--------------------------------------------------------------------------------
/pine64-diagnostics.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # This script is designed to be a general purpose diagnostic log and testing
3 | # script for the pine64 and related SBC boards. It heavily borrows from code
4 | # used in the Armbian project's armbianmonitor.
5 | #
6 | # Written 2017 Peter Feerick and contributors, released under GPLv3
7 | #
8 |
9 | #if user doesn't have permission for /var/log, write to /tmp
10 | if [ -w /var/log ]; then
11 | Log="/var/log/${0##*/}.log"
12 | else
13 | Log="/tmp/${0##*/}.log"
14 | fi
15 |
16 | VerifyRepairExcludes="/etc/|/boot/|cache|getty|/var/lib/smartmontools/"
17 |
18 | Main() {
19 | # check if stdout is a terminal...
20 | if test -t 1; then
21 | # see if it supports colors...
22 | ncolors=$(tput colors)
23 | if test -n "$ncolors" && test $ncolors -ge 8; then
24 | BOLD="$(tput bold)"
25 | NC='\033[0m' # No Color
26 | LGREEN='\033[1;32m'
27 | LRED='\e[0;91m'
28 | fi
29 | fi
30 |
31 | [ $# -eq 0 ] && (DisplayUsage ; exit 0)
32 |
33 | ParseOptions "$@"
34 |
35 | exit 0
36 | } # Main
37 |
38 | #thanks to tkaiser for the initial command for this function
39 | VerifyFiles() {
40 | echo -e "\n### file verification:\n"
41 |
42 | OUTPUT=$(dpkg --verify | egrep -v -i "${VerifyRepairExcludes}" | awk -F" /" '{print "/"$2}')
43 |
44 | if [[ -z $OUTPUT ]]; then
45 | echo -e "${LGREEN}${BOLD}It would appear you don't have any corrupt files or packages!${NC}"
46 | echo -e "If you still have concerns, use this scripts media test mode"
47 | echo -e "to do a stress test of your drive/storage device.\n"
48 | else
49 | echo -e "${LRED}${BOLD}It appears you *may* have corrupt packages.${NC} If you believe this to be the"
50 | echo -e "case (and not a customisation that you or a script has applied), re-run this"
51 | echo -e "script in fix mode to try and fix these packages.\n"
52 |
53 | echo -e "### The following changed from packaged state files were detected:\n"
54 | echo -e "${OUTPUT}\n"
55 | fi
56 |
57 | } # VerifyFiles
58 |
59 | #thanks to tkaiser for the initial command for this function
60 | VerifyAndFixFiles() {
61 | echo -e "\n### file verification and file/package repair:\n"
62 |
63 | STAGE1=$(dpkg --verify | egrep -v -i "${VerifyRepairExcludes}" | awk -F" /" '{print "/"$2}')
64 |
65 | if [[ -z $STAGE1 ]]; then
66 | echo -e "${LGREEN}${BOLD}It would appear you don't have any corrupt files or packages!${NC}"
67 | echo -e "\nIf you are experiencing issues, it is probably best to back"
68 | echo -e "up your data, and reinstall the OS from a new image.\n"
69 | else
70 | echo -e "### The following changed from packaged state files were detected:\n"
71 | echo -e "${STAGE1}"
72 |
73 | echo -e "\n### Identifying which packages the changed files belong to... "
74 | STAGE2=$(echo "${STAGE1}" | while read ; do dpkg -S "${REPLY}" | cut -f1 -d: ; done | sort | uniq)
75 |
76 | if [[ -z ${STAGE2} ]]; then
77 | echo -e "\n\n${LRED}${BOLD}An internal error has occured... Exiting!${NC}"
78 | exit 1
79 | else
80 | echo -e "\nThe following packages will be reinstalled:"
81 | echo -e "${STAGE2}"
82 |
83 | # test internet connection by poking google
84 | nc -zw1 google.com 443 >/dev/null 2>&1
85 |
86 | if [[ $? -eq 0 ]]; then
87 | echo -e "\n### Updating software repositories before package reinstall..."
88 | apt-get update -qq >/dev/null 2>&1
89 |
90 | echo "${STAGE2}" | while read;
91 | do
92 | echo -e "Reinstalling package: ${REPLY}"
93 | apt-get -q --reinstall -y install ${REPLY} >/dev/null 2>&1
94 | done
95 |
96 | echo -e "\n${LGREEN}${BOLD}Process complete.${NC} Reboot your device now and see if the issues that"
97 | echo -e "were identified have been successfully resolved."
98 | else
99 | echo -e "\n${LRED}${BOLD}It appears you don't have an active internet connection!!${NC}\n"
100 | echo -e "Repair cannot proceed without an internet connection as new/fresh versions of the"
101 | echo -e "package files are downloaded as part of the repair process. Please resolve the"
102 | echo -e "network/network issue and then try again. Exiting!\n"
103 |
104 | exit 1
105 | fi
106 | fi
107 | fi
108 | } # VerifyAndFixFiles
109 |
110 | # Most of the below has been shameless copied from the Armbian project's armbianmonitor,
111 | # because they did an amazing job at making a great diagnostic report! Specifically:
112 |
113 | # https://github.com/armbian/build/blob/master/packages/bsp/armbianmonitor/armbianmonitor-daemon
114 | # https://github.com/armbian/build/blob/master/packages/bsp/common/usr/bin/armbianmonitor
115 | # https://github.com/armbian/build/blob/master/packages/bsp/common/etc/init.d/armhwinfo
116 | GenerateLog() {
117 | echo -e "\n### dmesg:\n"
118 | dmesg
119 |
120 | echo -e "\n### meminfo:\n"
121 | cat /proc/meminfo
122 |
123 | echo -e "\n### ifconfig:\n"
124 | ifconfig
125 |
126 | echo -e "### partitions:\n"
127 | cat /proc/partitions
128 |
129 | echo -e "\n### df:\n"
130 | df -h
131 |
132 | echo -e "\n### Installed packages:\n\n$(dpkg -l | egrep "linux-|openmediavault")"
133 |
134 | echo -e "\n### Loaded modules:\n\n$(lsmod)"
135 |
136 | if [[ $(dpkg-query -W -f='${Status}' linux-pine64-package 2>/dev/null | grep -c "ok installed") == "1" ]]; then
137 | echo -e "\n### linux-pine64-package version:\n"
138 | apt-cache policy linux-pine64-package
139 | fi
140 |
141 | if [[ $(dpkg-query -W -f='${Status}' linux-rock64-package 2>/dev/null | grep -c "ok installed") == "1" ]]; then
142 | echo -e "\n### linux-rock64-package version:\n"
143 | apt-cache policy linux-rock64-package
144 | fi
145 |
146 | echo -e "\n### Kernel version:\n"
147 | uname -a
148 |
149 | echo -e "Searching for info on flash media... "
150 | get_flash_information >>${Log}
151 | which iostat >/dev/null 2>&1 && \
152 |
153 | echo -e "\n### Current sysinfo:\n\n"
154 | which iostat >/dev/null 2>&1 && echo -e "$(iostat -p ALL | grep -v '^loop')\n\n"
155 | echo -e "$(vmstat -w)\n\n$(free -h)\n\n$(dmesg | tail -n 250)"
156 | } # GenerateLog
157 |
158 | CheckCard() {
159 | if [ "$(id -u)" = "0" ]; then
160 | echo "Checking disks is not permitted as root or through sudo. Exiting" >&2
161 | exit 1
162 | fi
163 |
164 | if [ ! -d "$1" ]; then
165 | echo "\"$1\" does not exist or is no directory. Exiting" >&2
166 | exit 1
167 | fi
168 | TargetDir="$1"
169 |
170 | # check requirements
171 | which f3write >/dev/null 2>&1 || MissingTools=" f3"
172 | which iozone >/dev/null 2>&1 || MissingTools="${MissingTools} iozone3"
173 | if [ "X${MissingTools}" != "X" ]; then
174 | echo "Some tools are missing, please do a \"sudo apt-get -f -y install${MissingTools}\" to install them, and try again" >&2
175 | exit 1
176 | fi
177 |
178 | # check provided path
179 | Device="$(GetDevice "$1")"
180 | set ${Device}
181 | DeviceName=$1
182 | FileSystem=$2
183 | echo "${DeviceName}" | grep -q "mmcblk0" || echo -e "\n${BOLD}NOTE:${NC} It seems you're actually testing ${DeviceName} (${FileSystem})\n"
184 |
185 | TestDir="$(mktemp -d "${TargetDir}/cardtest.XXXXXX" || exit 1)"
186 | date "+%s" >"${TestDir}/.starttime" || exit 1
187 | trap "rm -rf \"${TestDir}\" ; exit 0" 0 1 2 3 15
188 | LogFile="$(mktemp /tmp/armbianmonitor_checks_${DeviceName##*/}_${FileSystem}.XXXXXX)"
189 |
190 | # start actual test, create a small file for some space reserve
191 | fallocate -l 32M "${TestDir}/empty.32m" 2>/dev/null || dd if=/dev/zero of="${TestDir}/empty.32m" bs=1M count=32 status=noxfer >/dev/null 2>&1
192 | ShowWarning=false
193 |
194 | # Start writing
195 | echo -e "Starting to fill ${DeviceName} with test patterns, please be patient this might take a very long time"
196 | f3write "${TestDir}" | tee "${LogFile}"
197 | touch "${TestDir}/.starttime" || ShowDeviceWarning
198 | rm "${TestDir}/empty.32m"
199 |
200 | # Start verify
201 | echo -e "\nNow verifying the written data:"
202 | echo "" >>"${LogFile}"
203 | f3read "${TestDir}" | tee -a "${LogFile}"
204 | touch "${TestDir}/.starttime" || ShowDeviceWarning
205 | rm "${TestDir}/"*.h2w
206 | echo -e "\nStarting iozone tests. Be patient, this can take a very long time to complete:"
207 | echo "" >>"${LogFile}"
208 | cd "${TestDir}"
209 | iozone -e -I -a -s 100M -r 4k -r 512k -r 16M -i 0 -i 1 -i 2 | tee -a "${LogFile}"
210 | touch "${TestDir}/.starttime" || ShowDeviceWarning
211 | echo -e "\n${BOLD}The results from testing ${DeviceName} (${FileSystem}):${NC}"
212 | egrep "Average|Data" "${LogFile}" | sort -r
213 | echo " random random"
214 | echo -e "reclen write rewrite read reread read write\c"
215 | awk -F"102400 " '/102400/ {print $2}' <"${LogFile}"
216 |
217 | # check health
218 | echo -e "\n${BOLD}Health summary: \c"
219 | egrep -q "Read-only|Input/output error" "${LogFile}" && (echo -e "${LRED}${BOLD}${DeviceName} failed${NC}" ; exit 0)
220 | grep -q "Data LOST: 0.00 Byte" "${LogFile}" && echo -e "${LGREEN}OK" || \
221 | (echo -e "${LRED}${BOLD}${DeviceName} failed. Replace it as soon as possible!" ; \
222 | grep -A3 "^Data LOST" "${LogFile}")
223 |
224 | # check performance
225 | RandomSpeed=$(awk -F" " '/102400 4/ {print $7"\t"$8}' <"${LogFile}")
226 | if [ "X${RandomSpeed}" != "X" ]; then
227 | # Only continue when we're able to read out iozone results
228 | set ${RandomSpeed}
229 | RandomReadSpead=$1
230 | RandomWriteSpead=$2
231 | ReadSpeed=$(awk -F" " '/Average reading speed/ {print $4"\t"$5}' <"${LogFile}")
232 | set ${ReadSpeed}
233 | if [ "X$2" = "XMB/s" ]; then
234 | RawReadSpead=$(echo "$1 * 1000" | bc -s | cut -f1 -d.)
235 | else
236 | RawReadSpead$(echo "$1" | cut -f1 -d.)
237 | fi
238 | echo -e "\n${NC}${BOLD}Performance summary:${NC}\nSequential reading speed:$(printf "%6s" $1) $2 \c"
239 | [ ${RawReadSpead} -le 2500 ] && Exclamation="${LRED}${BOLD}way " || Exclamation=""
240 | [ ${RawReadSpead} -le 5000 ] && Exclamation="${Exclamation}${BOLD}too "
241 | [ ${RawReadSpead} -le 7500 ] && echo -e "(${Exclamation}low${NC})\c"
242 | echo "${Exclamation}" | grep -q "too" && ShowWarning=true
243 | echo -e "\n 4K random reading speed:$(printf "%6s" ${RandomReadSpead}) KB/s \c"
244 | [ ${RandomReadSpead} -le 700 ] && Exclamation="${LRED}${BOLD}way " || Exclamation=""
245 | [ ${RandomReadSpead} -le 1400 ] && Exclamation="${Exclamation}${BOLD}too "
246 | [ ${RandomReadSpead} -le 2500 ] && echo -e "(${Exclamation}low${NC})\c"
247 | echo "${Exclamation}" | grep -q "too" && ShowWarning=true
248 | WriteSpeed=$(awk -F" " '/Average writing speed/ {print $4"\t"$5}' <"${LogFile}")
249 | set ${WriteSpeed}
250 | if [ "X$2" = "XMB/s" ]; then
251 | RawWriteSpeed=$(echo "$1 * 1000" | bc -s | cut -f1 -d.)
252 | else
253 | RawWriteSpeed=$(echo "$1" | cut -f1 -d.)
254 | fi
255 | echo -e "\nSequential writing speed:$(printf "%6s" $1) $2 \c"
256 | [ ${RawWriteSpeed} -le 2500 ] && Exclamation="${LRED}${BOLD}way " || Exclamation=""
257 | [ ${RawWriteSpeed} -le 4000 ] && Exclamation="${Exclamation}${BOLD}too "
258 | [ ${RawWriteSpeed} -le 6000 ] && echo -e "(${Exclamation}low${NC})\c"
259 | echo "${Exclamation}" | grep -q "too" && ShowWarning=true
260 | echo -e "\n 4K random writing speed:$(printf "%6s" ${RandomWriteSpead}) KB/s \c"
261 | [ ${RandomWriteSpead} -le 400 ] && Exclamation="${LRED}${BOLD}way " || Exclamation=""
262 | [ ${RandomWriteSpead} -le 750 ] && Exclamation="${Exclamation}${BOLD}too "
263 | [ ${RandomWriteSpead} -lt 1000 ] && echo -e "(${Exclamation}low${NC})\c"
264 | echo "${Exclamation}" | grep -q "too" && ShowWarning=true
265 | if [ "X${ShowWarning}" = "Xtrue" ]; then
266 | echo -e "\n\n${BOLD}The device you tested seems to perform too slow to be used with pine64."
267 | echo -e "This applies especially to desktop images where slow storage is responsible"
268 | echo -e "for sluggish behaviour. If you want to have fun with your device do NOT use"
269 | echo -e "this media to put the OS image or the user homedirs on.${NC}\c"
270 | fi
271 | echo -e "\n\nTo interpret the results above correctly or search for better storage
272 | alternatives please refer to http://oss.digirati.com.br/f3/ and also
273 | http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-microsd-card
274 | and http://thewirecutter.com/reviews/best-microsd-card/"
275 | fi
276 | } # CheckCard
277 |
278 | GetDevice() {
279 | TestPath=$(findmnt "$1" | awk -F" " '/\/dev\// {print $2"\t"$3}')
280 | if [[ -z ${TestPath} && -n "${1%/*}" ]]; then
281 | GetDevice "${1%/*}"
282 | elif [[ -z ${TestPath} && -z "${1%/*}" ]]; then
283 | findmnt / | awk -F" " '/\/dev\// {print $2"\t"$3}'
284 | else
285 | echo "${TestPath}"
286 | fi
287 | } # GetDevice
288 |
289 | get_flash_information() {
290 | # http://www.bunniestudios.com/blog/?page_id=1022
291 | find /sys -name oemid | while read Device ; do
292 | DeviceNode="${Device%/*}"
293 | DeviceName="${DeviceNode##*/}"
294 | echo -e "\n### ${DeviceName} info:\n"
295 | find "${DeviceNode}" -maxdepth 1 -type f | while read ; do
296 | NodeName="${REPLY##*/}"
297 | echo -e "$(printf "%20s" ${NodeName}): $(cat "${DeviceNode}/${NodeName}" | tr '\n' " ")"
298 | done
299 | done
300 | } # get_flash_information
301 |
302 | UploadSupportLogs() {
303 | #prevent colour escape sequences in log
304 | BOLD=''
305 | NC=''
306 | LGREEN=''
307 | LRED=''
308 |
309 | #check requirements
310 | which fping >/dev/null 2>&1 || MissingTools=" fping"
311 | which curl >/dev/null 2>&1 || MissingTools="${MissingTools} curl"
312 | which iostat >/dev/null 2>&1 || MissingTools="${MissingTools} sysstat"
313 |
314 | if [ "X${MissingTools}" != "X" ]; then
315 | echo -e "Some tools are missing, installing: ${MissingTools}" >&2
316 | apt-get -f -qq -y install ${MissingTools} >/dev/null 2>&1
317 | fi
318 |
319 | echo -e "Generating diagnostic logs... "
320 | GenerateLog > ${Log}
321 | echo -e "Running file integrity checks... "
322 | VerifyFiles >> ${Log}
323 |
324 | #check network connection
325 | fping sprunge.us | grep -q alive || \
326 | (echo "Network/firewall problem detected. Please fix this or upload ${Log} manually." >&2 ; exit 1)
327 |
328 | echo -ne "\nIP obfuscated log uploaded to \c"
329 | # obfuscate IPv4 addresses somehow but not too much
330 | cat ${Log} | \
331 | sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
332 | | curl -F 'sprunge=<-' http://sprunge.us
333 |
334 | echo -e "Please post the above URL on the forum where you've been asked for it."
335 | } # UploadSupportLogs
336 |
337 | RequireRoot() {
338 | if [ "$(id -u)" != "0" ]; then
339 | echo "This function requires root privleges - run as root or through sudo. Exiting" >&2
340 | exit 1
341 | fi
342 | } # RequireRoot
343 |
344 | DisplayUsage() {
345 | echo -e "\nUsage: ${BOLD}${0##*/} [-h] [-c \$path] [-f] [-l] [-L] [-m] [-u] [-v]${NC}\n"
346 | echo -e "############################################################################"
347 | echo -e "\n Use ${BOLD}${0##*/}${NC} for the following tasks:\n"
348 | echo -e " ${0##*/} ${BOLD}-c /path/to/test${NC} performs disk health/performance tests"
349 | echo -e " ${0##*/} ${BOLD}-f${NC} tries to fix detected corrupt packages"
350 | echo -e " ${0##*/} ${BOLD}-l${NC} outputs diagnostic logs to the screen via less"
351 | echo -e " ${0##*/} ${BOLD}-L${NC} outputs diagnostic logs to the screen as is"
352 | echo -e " ${0##*/} ${BOLD}-m${NC} provides simple CLI monitoring"
353 | echo -e " ${0##*/} ${BOLD}-u${NC} tries to upload diagnostic logs for support purposes"
354 | echo -e " ${0##*/} ${BOLD}-v${NC} tries to diagnose corrupt packages and files"
355 | echo -e "\n############################################################################\n"
356 | } # DisplayUsage
357 |
358 | ParseOptions() {
359 | while getopts 'hHlLvVfFmMuUc:C:' c ; do
360 | case ${c} in
361 | h|H)
362 | # display usage info
363 | DisplayUsage
364 | exit 0
365 | ;;
366 |
367 | l)
368 | # generate logs and pipe to screen via less
369 | GenerateLog | less
370 | exit 0
371 | ;;
372 |
373 | L)
374 | # generate logs and output to display
375 | GenerateLog
376 | exit 0
377 | ;;
378 |
379 | v|V)
380 | # file verification mode
381 | RequireRoot
382 | VerifyFiles
383 | exit 0
384 | ;;
385 |
386 | f|F)
387 | # file verification and repair mode
388 | RequireRoot
389 | VerifyAndFixFiles
390 | exit 0
391 | ;;
392 |
393 | m|M)
394 | # monitoring mode
395 | echo -e "Stop monitoring using [ctrl]-[c]"
396 | MonitorMode
397 | exit 0
398 | ;;
399 |
400 | u|U)
401 | # upload generated logs for support
402 | RequireRoot
403 | UploadSupportLogs
404 | exit 0
405 | ;;
406 |
407 | c|C)
408 | # check card mode
409 | CheckCard "${OPTARG}"
410 | exit 0
411 | ;;
412 |
413 | esac
414 | done
415 | } # ParseOptions
416 |
417 | MonitorMode() {
418 | # $1 is the time in seconds to pause between two prints, defaults to 5 seconds
419 | # This functions prints out endlessly:
420 | # - time/date
421 | # - average 1m load
422 | # - detailed CPU statistics
423 | # - Soc temperature if available
424 | # - PMIC temperature if available
425 | # TODO: Format output nicely
426 | LastUserStat=0
427 | LastNiceStat=0
428 | LastSystemStat=0
429 | LastIdleStat=0
430 | LastIOWaitStat=0
431 | LastIrqStat=0
432 | LastSoftIrqStat=0
433 | LastCpuStatCheck=0
434 |
435 | DisplayHeader="Time CPU load %cpu %sys %usr %nice %io %irq"
436 | CPUs=normal
437 | [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ] && DisplayHeader="${DisplayHeader} CPU" || SocTemp='n/a'
438 | echo -e "${DisplayHeader}\c"
439 | Counter=0
440 | while true ; do
441 | let Counter++
442 | if [ ${Counter} -eq 15 ]; then
443 | echo -e "\n${DisplayHeader}\c"
444 | Counter=0
445 | fi
446 | LoadAvg=$(cut -f1 -d" " /dev/null
449 | elif [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ]; then
450 | CpuFreq=$(awk '{printf ("%0.0f",$1/1000); }' /dev/null
451 | else
452 | CpuFreq='n/a'
453 | fi
454 | echo -e "\n$(date "+%H:%M:%S"): $(printf "%4s" ${CpuFreq})MHz $(printf "%5s" ${LoadAvg}) $(ProcessStats)\c"
455 | if [ "X${SocTemp}" != "Xn/a" ]; then
456 | read SocTemp = cool_upper_limit:
90 | if not fanRunning:
91 | if args.verbose: print '{:%H:%M:%S}'.format(datetime.datetime.now()), "Upper threshold of", str(cool_upper_limit) + degreeSymbol + "C", "reached, switching fan on"
92 | GPIO.output(fan_pin,GPIO.HIGH)
93 | fanRunning = True
94 | else:
95 | pass
96 | else:
97 | # print "do nothing"
98 | # if fanRunning = true:
99 | # GPIO.output(fan_pin,GPIO.HIGH)
100 | # else:
101 | # GPIO.output(fan_pin,GPIO.LOW)
102 |
103 | pass
104 |
105 | # print "sleep" # for debugging
106 | sleep(delay)
107 |
108 | if __name__ == "__main__":
109 | main()
110 |
111 |
--------------------------------------------------------------------------------
/pine64-gpio-number.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | """Converts PC13 style GPIO designators to sysfs usable values"""
4 |
5 | import sys
6 | import string
7 | import re
8 |
9 | def convert(value):
10 | """Does the actual conversion"""
11 | alp = value[1]
12 | idx = string.ascii_uppercase.index(alp)
13 | num = int(value[2:], 10)
14 | res = idx * 32 + num
15 | return res
16 |
17 | if __name__ == "__main__":
18 | ARGS = sys.argv[1:]
19 | if not ARGS:
20 | print("Usage: %s " % sys.argv[0])
21 | sys.exit(1)
22 |
23 | if not re.match(r'[P][BCHL][0-9]{1,2}$', ARGS[0].upper()):
24 | print("Input: '%s' not a valid GPIO pin reference!" % ARGS[0])
25 | print()
26 | print("It should look something like PC13, where")
27 | print(" P=Pin")
28 | print(" C=3rd bank of GPIO connections")
29 | print(" 13=GPIO in that specific bank")
30 | sys.exit(1)
31 |
32 | print("%d" % convert(ARGS[0].upper()))
33 |
--------------------------------------------------------------------------------
/pinebook/asound.state:
--------------------------------------------------------------------------------
1 | state.audiocodec {
2 | control.1 {
3 | iface MIXER
4 | name 'AIF1 ADC timeslot 0 volume'
5 | value.0 0
6 | value.1 0
7 | comment {
8 | access 'read write'
9 | type INTEGER
10 | count 2
11 | range '0 - 255'
12 | dbmin -11925
13 | dbmax 7200
14 | dbvalue.0 -11925
15 | dbvalue.1 -11925
16 | }
17 | }
18 | control.2 {
19 | iface MIXER
20 | name 'AIF1 ADC timeslot 1 volume'
21 | value.0 0
22 | value.1 0
23 | comment {
24 | access 'read write'
25 | type INTEGER
26 | count 2
27 | range '0 - 255'
28 | dbmin -11925
29 | dbmax 7200
30 | dbvalue.0 -11925
31 | dbvalue.1 -11925
32 | }
33 | }
34 | control.3 {
35 | iface MIXER
36 | name 'AIF1 DAC timeslot 0 volume'
37 | value.0 165
38 | value.1 165
39 | comment {
40 | access 'read write'
41 | type INTEGER
42 | count 2
43 | range '0 - 255'
44 | dbmin -11925
45 | dbmax 7200
46 | dbvalue.0 450
47 | dbvalue.1 450
48 | }
49 | }
50 | control.4 {
51 | iface MIXER
52 | name 'AIF1 DAC timeslot 1 volume'
53 | value.0 0
54 | value.1 0
55 | comment {
56 | access 'read write'
57 | type INTEGER
58 | count 2
59 | range '0 - 255'
60 | dbmin -11925
61 | dbmax 7200
62 | dbvalue.0 -11925
63 | dbvalue.1 -11925
64 | }
65 | }
66 | control.5 {
67 | iface MIXER
68 | name 'AIF1 ADC timeslot 0 mixer gain'
69 | value.0 0
70 | value.1 0
71 | comment {
72 | access 'read write'
73 | type INTEGER
74 | count 2
75 | range '0 - 15'
76 | dbmin -600
77 | dbmax 8400
78 | dbvalue.0 -600
79 | dbvalue.1 -600
80 | }
81 | }
82 | control.6 {
83 | iface MIXER
84 | name 'AIF1 ADC timeslot 1 mixer gain'
85 | value.0 0
86 | value.1 0
87 | comment {
88 | access 'read write'
89 | type INTEGER
90 | count 2
91 | range '0 - 3'
92 | dbmin -600
93 | dbmax 1200
94 | dbvalue.0 -600
95 | dbvalue.1 -600
96 | }
97 | }
98 | control.7 {
99 | iface MIXER
100 | name 'AIF2 ADC volume'
101 | value.0 0
102 | value.1 0
103 | comment {
104 | access 'read write'
105 | type INTEGER
106 | count 2
107 | range '0 - 255'
108 | dbmin -11925
109 | dbmax 7200
110 | dbvalue.0 -11925
111 | dbvalue.1 -11925
112 | }
113 | }
114 | control.8 {
115 | iface MIXER
116 | name 'AIF2 DAC volume'
117 | value.0 0
118 | value.1 0
119 | comment {
120 | access 'read write'
121 | type INTEGER
122 | count 2
123 | range '0 - 255'
124 | dbmin -11925
125 | dbmax 7200
126 | dbvalue.0 -11925
127 | dbvalue.1 -11925
128 | }
129 | }
130 | control.9 {
131 | iface MIXER
132 | name 'AIF2 ADC mixer gain'
133 | value.0 0
134 | value.1 0
135 | comment {
136 | access 'read write'
137 | type INTEGER
138 | count 2
139 | range '0 - 15'
140 | dbmin -600
141 | dbmax 8400
142 | dbvalue.0 -600
143 | dbvalue.1 -600
144 | }
145 | }
146 | control.10 {
147 | iface MIXER
148 | name 'ADC volume'
149 | value.0 0
150 | value.1 0
151 | comment {
152 | access 'read write'
153 | type INTEGER
154 | count 2
155 | range '0 - 255'
156 | dbmin -11925
157 | dbmax 7200
158 | dbvalue.0 -11925
159 | dbvalue.1 -11925
160 | }
161 | }
162 | control.11 {
163 | iface MIXER
164 | name 'DAC volume'
165 | value.0 160
166 | value.1 160
167 | comment {
168 | access 'read write'
169 | type INTEGER
170 | count 2
171 | range '0 - 255'
172 | dbmin -11925
173 | dbmax 7200
174 | dbvalue.0 75
175 | dbvalue.1 75
176 | }
177 | }
178 | control.12 {
179 | iface MIXER
180 | name 'DAC mixer gain'
181 | value.0 0
182 | value.1 0
183 | comment {
184 | access 'read write'
185 | type INTEGER
186 | count 2
187 | range '0 - 15'
188 | dbmin -600
189 | dbmax 8400
190 | dbvalue.0 -600
191 | dbvalue.1 -600
192 | }
193 | }
194 | control.13 {
195 | iface MIXER
196 | name 'digital volume'
197 | value 0
198 | comment {
199 | access 'read write'
200 | type INTEGER
201 | count 1
202 | range '0 - 63'
203 | dbmin -7308
204 | dbmax 0
205 | dbvalue.0 -7308
206 | }
207 | }
208 | control.14 {
209 | iface MIXER
210 | name 'earpiece volume'
211 | value 0
212 | comment {
213 | access 'read write'
214 | type INTEGER
215 | count 1
216 | range '0 - 31'
217 | dbmin -4350
218 | dbmax 300
219 | dbvalue.0 -4350
220 | }
221 | }
222 | control.15 {
223 | iface MIXER
224 | name 'speaker volume'
225 | value 23
226 | comment {
227 | access 'read write'
228 | type INTEGER
229 | count 1
230 | range '0 - 31'
231 | dbmin -4800
232 | dbmax -150
233 | dbvalue.0 -1350
234 | }
235 | }
236 | control.16 {
237 | iface MIXER
238 | name 'headphone volume'
239 | value 0
240 | comment {
241 | access 'read write'
242 | type INTEGER
243 | count 1
244 | range '0 - 63'
245 | dbmin -6300
246 | dbmax 0
247 | dbvalue.0 -6300
248 | }
249 | }
250 | control.17 {
251 | iface MIXER
252 | name 'MIC1_G boost stage output mixer control'
253 | value 0
254 | comment {
255 | access 'read write'
256 | type INTEGER
257 | count 1
258 | range '0 - 7'
259 | dbmin -450
260 | dbmax 600
261 | dbvalue.0 -450
262 | }
263 | }
264 | control.18 {
265 | iface MIXER
266 | name 'MIC1 boost AMP gain control'
267 | value 0
268 | comment {
269 | access 'read write'
270 | type INTEGER
271 | count 1
272 | range '0 - 7'
273 | dbmin 0
274 | dbmax 1400
275 | dbvalue.0 0
276 | }
277 | }
278 | control.19 {
279 | iface MIXER
280 | name 'MIC2 BST stage to L_R outp mixer gain'
281 | value 0
282 | comment {
283 | access 'read write'
284 | type INTEGER
285 | count 1
286 | range '0 - 7'
287 | dbmin -450
288 | dbmax 600
289 | dbvalue.0 -450
290 | }
291 | }
292 | control.20 {
293 | iface MIXER
294 | name 'MIC2 boost AMP gain control'
295 | value 0
296 | comment {
297 | access 'read write'
298 | type INTEGER
299 | count 1
300 | range '0 - 7'
301 | dbmin 0
302 | dbmax 1400
303 | dbvalue.0 0
304 | }
305 | }
306 | control.21 {
307 | iface MIXER
308 | name 'LINEINL/R to L_R output mixer gain'
309 | value 0
310 | comment {
311 | access 'read write'
312 | type INTEGER
313 | count 1
314 | range '0 - 7'
315 | dbmin -450
316 | dbmax 600
317 | dbvalue.0 -450
318 | }
319 | }
320 | control.22 {
321 | iface MIXER
322 | name 'ADC input gain control'
323 | value 0
324 | comment {
325 | access 'read write'
326 | type INTEGER
327 | count 1
328 | range '0 - 7'
329 | dbmin -450
330 | dbmax 600
331 | dbvalue.0 -450
332 | }
333 | }
334 | control.23 {
335 | iface MIXER
336 | name 'Phoneout gain control'
337 | value 0
338 | comment {
339 | access 'read write'
340 | type INTEGER
341 | count 1
342 | range '0 - 7'
343 | dbmin -450
344 | dbmax 600
345 | dbvalue.0 -450
346 | }
347 | }
348 | control.24 {
349 | iface MIXER
350 | name 'SRC FUCTION'
351 | value false
352 | comment {
353 | access 'read write'
354 | type BOOLEAN
355 | count 1
356 | }
357 | }
358 | control.25 {
359 | iface MIXER
360 | name 'I2S HUB FUNC'
361 | value false
362 | comment {
363 | access 'read write'
364 | type BOOLEAN
365 | count 1
366 | }
367 | }
368 | control.26 {
369 | iface MIXER
370 | name 'Phoneout Mixer MIC1 boost Switch'
371 | value false
372 | comment {
373 | access 'read write'
374 | type BOOLEAN
375 | count 1
376 | }
377 | }
378 | control.27 {
379 | iface MIXER
380 | name 'Phoneout Mixer MIC2 boost Switch'
381 | value false
382 | comment {
383 | access 'read write'
384 | type BOOLEAN
385 | count 1
386 | }
387 | }
388 | control.28 {
389 | iface MIXER
390 | name 'Phoneout Mixer Rout_Mixer_Switch'
391 | value false
392 | comment {
393 | access 'read write'
394 | type BOOLEAN
395 | count 1
396 | }
397 | }
398 | control.29 {
399 | iface MIXER
400 | name 'Phoneout Mixer Lout_Mixer_Switch'
401 | value false
402 | comment {
403 | access 'read write'
404 | type BOOLEAN
405 | count 1
406 | }
407 | }
408 | control.30 {
409 | iface MIXER
410 | name 'ADCR Mux'
411 | value DMIC
412 | comment {
413 | access 'read write'
414 | type ENUMERATED
415 | count 1
416 | item.0 ADC
417 | item.1 DMIC
418 | }
419 | }
420 | control.31 {
421 | iface MIXER
422 | name 'ADCL Mux'
423 | value DMIC
424 | comment {
425 | access 'read write'
426 | type ENUMERATED
427 | count 1
428 | item.0 ADC
429 | item.1 DMIC
430 | }
431 | }
432 | control.32 {
433 | iface MIXER
434 | name 'MIC2 SRC'
435 | value MIC2
436 | comment {
437 | access 'read write'
438 | type ENUMERATED
439 | count 1
440 | item.0 MIC3
441 | item.1 MIC2
442 | }
443 | }
444 | control.33 {
445 | iface MIXER
446 | name 'RADC input Mixer MIC1 boost Switch'
447 | value false
448 | comment {
449 | access 'read write'
450 | type BOOLEAN
451 | count 1
452 | }
453 | }
454 | control.34 {
455 | iface MIXER
456 | name 'RADC input Mixer MIC2 boost Switch'
457 | value false
458 | comment {
459 | access 'read write'
460 | type BOOLEAN
461 | count 1
462 | }
463 | }
464 | control.35 {
465 | iface MIXER
466 | name 'RADC input Mixer LINEINR Switch'
467 | value false
468 | comment {
469 | access 'read write'
470 | type BOOLEAN
471 | count 1
472 | }
473 | }
474 | control.36 {
475 | iface MIXER
476 | name 'RADC input Mixer r_output mixer Switch'
477 | value false
478 | comment {
479 | access 'read write'
480 | type BOOLEAN
481 | count 1
482 | }
483 | }
484 | control.37 {
485 | iface MIXER
486 | name 'RADC input Mixer l_output mixer Switch'
487 | value false
488 | comment {
489 | access 'read write'
490 | type BOOLEAN
491 | count 1
492 | }
493 | }
494 | control.38 {
495 | iface MIXER
496 | name 'RADC input Mixer PHONINN Switch'
497 | value false
498 | comment {
499 | access 'read write'
500 | type BOOLEAN
501 | count 1
502 | }
503 | }
504 | control.39 {
505 | iface MIXER
506 | name 'RADC input Mixer PHONINN-PHONINP Switch'
507 | value false
508 | comment {
509 | access 'read write'
510 | type BOOLEAN
511 | count 1
512 | }
513 | }
514 | control.40 {
515 | iface MIXER
516 | name 'LADC input Mixer MIC1 boost Switch'
517 | value false
518 | comment {
519 | access 'read write'
520 | type BOOLEAN
521 | count 1
522 | }
523 | }
524 | control.41 {
525 | iface MIXER
526 | name 'LADC input Mixer MIC2 boost Switch'
527 | value false
528 | comment {
529 | access 'read write'
530 | type BOOLEAN
531 | count 1
532 | }
533 | }
534 | control.42 {
535 | iface MIXER
536 | name 'LADC input Mixer LINEINL Switch'
537 | value false
538 | comment {
539 | access 'read write'
540 | type BOOLEAN
541 | count 1
542 | }
543 | }
544 | control.43 {
545 | iface MIXER
546 | name 'LADC input Mixer l_output mixer Switch'
547 | value false
548 | comment {
549 | access 'read write'
550 | type BOOLEAN
551 | count 1
552 | }
553 | }
554 | control.44 {
555 | iface MIXER
556 | name 'LADC input Mixer r_output mixer Switch'
557 | value false
558 | comment {
559 | access 'read write'
560 | type BOOLEAN
561 | count 1
562 | }
563 | }
564 | control.45 {
565 | iface MIXER
566 | name 'LADC input Mixer PHONINP Switch'
567 | value false
568 | comment {
569 | access 'read write'
570 | type BOOLEAN
571 | count 1
572 | }
573 | }
574 | control.46 {
575 | iface MIXER
576 | name 'LADC input Mixer PHONINP-PHONINN Switch'
577 | value false
578 | comment {
579 | access 'read write'
580 | type BOOLEAN
581 | count 1
582 | }
583 | }
584 | control.47 {
585 | iface MIXER
586 | name 'AIF3OUT Mux'
587 | value 'AIF2 ADC left channel'
588 | comment {
589 | access 'read write'
590 | type ENUMERATED
591 | count 1
592 | item.0 'AIF2 ADC left channel'
593 | item.1 'AIF2 ADC right channel'
594 | }
595 | }
596 | control.48 {
597 | iface MIXER
598 | name 'AIF2 ADR Mixer AIF1 DA0R Switch'
599 | value false
600 | comment {
601 | access 'read write'
602 | type BOOLEAN
603 | count 1
604 | }
605 | }
606 | control.49 {
607 | iface MIXER
608 | name 'AIF2 ADR Mixer AIF1 DA1R Switch'
609 | value false
610 | comment {
611 | access 'read write'
612 | type BOOLEAN
613 | count 1
614 | }
615 | }
616 | control.50 {
617 | iface MIXER
618 | name 'AIF2 ADR Mixer AIF2 DACL Switch'
619 | value false
620 | comment {
621 | access 'read write'
622 | type BOOLEAN
623 | count 1
624 | }
625 | }
626 | control.51 {
627 | iface MIXER
628 | name 'AIF2 ADR Mixer ADCR Switch'
629 | value false
630 | comment {
631 | access 'read write'
632 | type BOOLEAN
633 | count 1
634 | }
635 | }
636 | control.52 {
637 | iface MIXER
638 | name 'AIF2 ADL Mixer AIF1 DA0L Switch'
639 | value false
640 | comment {
641 | access 'read write'
642 | type BOOLEAN
643 | count 1
644 | }
645 | }
646 | control.53 {
647 | iface MIXER
648 | name 'AIF2 ADL Mixer AIF1 DA1L Switch'
649 | value false
650 | comment {
651 | access 'read write'
652 | type BOOLEAN
653 | count 1
654 | }
655 | }
656 | control.54 {
657 | iface MIXER
658 | name 'AIF2 ADL Mixer AIF2 DACR Switch'
659 | value false
660 | comment {
661 | access 'read write'
662 | type BOOLEAN
663 | count 1
664 | }
665 | }
666 | control.55 {
667 | iface MIXER
668 | name 'AIF2 ADL Mixer ADCL Switch'
669 | value false
670 | comment {
671 | access 'read write'
672 | type BOOLEAN
673 | count 1
674 | }
675 | }
676 | control.56 {
677 | iface MIXER
678 | name 'AIF2INR Mux'
679 | value AIF2_DACR
680 | comment {
681 | access 'read write'
682 | type ENUMERATED
683 | count 1
684 | item.0 AIF2_DACR
685 | item.1 AIF2_DACL
686 | item.2 SUM_AIF2DACL_AIF2DACR
687 | item.3 AVE_AIF2DACL_AIF2DACR
688 | }
689 | }
690 | control.57 {
691 | iface MIXER
692 | name 'AIF2INL Mux'
693 | value AIF2_DACL
694 | comment {
695 | access 'read write'
696 | type ENUMERATED
697 | count 1
698 | item.0 AIF2_DACL
699 | item.1 AIF2_DACR
700 | item.2 SUM_AIF2DACL_AIF2DACR
701 | item.3 AVE_AIF2DACL_AIF2DACR
702 | }
703 | }
704 | control.58 {
705 | iface MIXER
706 | name 'AIF2OUTR Mux'
707 | value AIF2_ADCR
708 | comment {
709 | access 'read write'
710 | type ENUMERATED
711 | count 1
712 | item.0 AIF2_ADCR
713 | item.1 AIF2_ADCL
714 | item.2 SUM_AIF2_ADCL_AIF2_ADCR
715 | item.3 AVE_AIF2_ADCL_AIF2_ADCR
716 | }
717 | }
718 | control.59 {
719 | iface MIXER
720 | name 'AIF2OUTL Mux'
721 | value AIF2_ADCL
722 | comment {
723 | access 'read write'
724 | type ENUMERATED
725 | count 1
726 | item.0 AIF2_ADCL
727 | item.1 AIF2_ADCR
728 | item.2 SUM_AIF2_ADCL_AIF2_ADCR
729 | item.3 AVE_AIF2_ADCL_AIF2_ADCR
730 | }
731 | }
732 | control.60 {
733 | iface MIXER
734 | name 'EAR Mux'
735 | value DACR
736 | comment {
737 | access 'read write'
738 | type ENUMERATED
739 | count 1
740 | item.0 DACR
741 | item.1 DACL
742 | item.2 'Right Analog Mixer'
743 | item.3 'Left Analog Mixer'
744 | }
745 | }
746 | control.61 {
747 | iface MIXER
748 | name 'SPK_L Mux'
749 | value 'MIXEL Switch'
750 | comment {
751 | access 'read write'
752 | type ENUMERATED
753 | count 1
754 | item.0 'MIXEL Switch'
755 | item.1 'MIXL MIXR Switch'
756 | }
757 | }
758 | control.62 {
759 | iface MIXER
760 | name 'SPK_R Mux'
761 | value 'MIXER Switch'
762 | comment {
763 | access 'read write'
764 | type ENUMERATED
765 | count 1
766 | item.0 'MIXER Switch'
767 | item.1 'MIXR MIXL Switch'
768 | }
769 | }
770 | control.63 {
771 | iface MIXER
772 | name 'HP_L Mux'
773 | value 'DACL HPL Switch'
774 | comment {
775 | access 'read write'
776 | type ENUMERATED
777 | count 1
778 | item.0 'DACL HPL Switch'
779 | item.1 'Left Analog Mixer HPL Switch'
780 | }
781 | }
782 | control.64 {
783 | iface MIXER
784 | name 'HP_R Mux'
785 | value 'DACR HPR Switch'
786 | comment {
787 | access 'read write'
788 | type ENUMERATED
789 | count 1
790 | item.0 'DACR HPR Switch'
791 | item.1 'Right Analog Mixer HPR Switch'
792 | }
793 | }
794 | control.65 {
795 | iface MIXER
796 | name 'Right Output Mixer DACL Switch'
797 | value false
798 | comment {
799 | access 'read write'
800 | type BOOLEAN
801 | count 1
802 | }
803 | }
804 | control.66 {
805 | iface MIXER
806 | name 'Right Output Mixer DACR Switch'
807 | value true
808 | comment {
809 | access 'read write'
810 | type BOOLEAN
811 | count 1
812 | }
813 | }
814 | control.67 {
815 | iface MIXER
816 | name 'Right Output Mixer LINEINR Switch'
817 | value false
818 | comment {
819 | access 'read write'
820 | type BOOLEAN
821 | count 1
822 | }
823 | }
824 | control.68 {
825 | iface MIXER
826 | name 'Right Output Mixer MIC2Booststage Switch'
827 | value false
828 | comment {
829 | access 'read write'
830 | type BOOLEAN
831 | count 1
832 | }
833 | }
834 | control.69 {
835 | iface MIXER
836 | name 'Right Output Mixer MIC1Booststage Switch'
837 | value false
838 | comment {
839 | access 'read write'
840 | type BOOLEAN
841 | count 1
842 | }
843 | }
844 | control.70 {
845 | iface MIXER
846 | name 'Right Output Mixer PHONEINN Switch'
847 | value false
848 | comment {
849 | access 'read write'
850 | type BOOLEAN
851 | count 1
852 | }
853 | }
854 | control.71 {
855 | iface MIXER
856 | name 'Right Output Mixer PHONEINN-PHONEINP Switch'
857 | value false
858 | comment {
859 | access 'read write'
860 | type BOOLEAN
861 | count 1
862 | }
863 | }
864 | control.72 {
865 | iface MIXER
866 | name 'Left Output Mixer DACR Switch'
867 | value false
868 | comment {
869 | access 'read write'
870 | type BOOLEAN
871 | count 1
872 | }
873 | }
874 | control.73 {
875 | iface MIXER
876 | name 'Left Output Mixer DACL Switch'
877 | value true
878 | comment {
879 | access 'read write'
880 | type BOOLEAN
881 | count 1
882 | }
883 | }
884 | control.74 {
885 | iface MIXER
886 | name 'Left Output Mixer LINEINL Switch'
887 | value false
888 | comment {
889 | access 'read write'
890 | type BOOLEAN
891 | count 1
892 | }
893 | }
894 | control.75 {
895 | iface MIXER
896 | name 'Left Output Mixer MIC2Booststage Switch'
897 | value false
898 | comment {
899 | access 'read write'
900 | type BOOLEAN
901 | count 1
902 | }
903 | }
904 | control.76 {
905 | iface MIXER
906 | name 'Left Output Mixer MIC1Booststage Switch'
907 | value false
908 | comment {
909 | access 'read write'
910 | type BOOLEAN
911 | count 1
912 | }
913 | }
914 | control.77 {
915 | iface MIXER
916 | name 'Left Output Mixer PHONEINP Switch'
917 | value false
918 | comment {
919 | access 'read write'
920 | type BOOLEAN
921 | count 1
922 | }
923 | }
924 | control.78 {
925 | iface MIXER
926 | name 'Left Output Mixer PHONEINP-PHONEINN Switch'
927 | value false
928 | comment {
929 | access 'read write'
930 | type BOOLEAN
931 | count 1
932 | }
933 | }
934 | control.79 {
935 | iface MIXER
936 | name 'DACR Mixer ADCR Switch'
937 | value false
938 | comment {
939 | access 'read write'
940 | type BOOLEAN
941 | count 1
942 | }
943 | }
944 | control.80 {
945 | iface MIXER
946 | name 'DACR Mixer AIF2DACR Switch'
947 | value false
948 | comment {
949 | access 'read write'
950 | type BOOLEAN
951 | count 1
952 | }
953 | }
954 | control.81 {
955 | iface MIXER
956 | name 'DACR Mixer AIF1DA1R Switch'
957 | value false
958 | comment {
959 | access 'read write'
960 | type BOOLEAN
961 | count 1
962 | }
963 | }
964 | control.82 {
965 | iface MIXER
966 | name 'DACR Mixer AIF1DA0R Switch'
967 | value true
968 | comment {
969 | access 'read write'
970 | type BOOLEAN
971 | count 1
972 | }
973 | }
974 | control.83 {
975 | iface MIXER
976 | name 'DACL Mixer ADCL Switch'
977 | value false
978 | comment {
979 | access 'read write'
980 | type BOOLEAN
981 | count 1
982 | }
983 | }
984 | control.84 {
985 | iface MIXER
986 | name 'DACL Mixer AIF2DACL Switch'
987 | value false
988 | comment {
989 | access 'read write'
990 | type BOOLEAN
991 | count 1
992 | }
993 | }
994 | control.85 {
995 | iface MIXER
996 | name 'DACL Mixer AIF1DA1L Switch'
997 | value false
998 | comment {
999 | access 'read write'
1000 | type BOOLEAN
1001 | count 1
1002 | }
1003 | }
1004 | control.86 {
1005 | iface MIXER
1006 | name 'DACL Mixer AIF1DA0L Switch'
1007 | value true
1008 | comment {
1009 | access 'read write'
1010 | type BOOLEAN
1011 | count 1
1012 | }
1013 | }
1014 | control.87 {
1015 | iface MIXER
1016 | name 'AIF1 AD1R Mixer AIF2 DACR Switch'
1017 | value false
1018 | comment {
1019 | access 'read write'
1020 | type BOOLEAN
1021 | count 1
1022 | }
1023 | }
1024 | control.88 {
1025 | iface MIXER
1026 | name 'AIF1 AD1R Mixer ADCR Switch'
1027 | value false
1028 | comment {
1029 | access 'read write'
1030 | type BOOLEAN
1031 | count 1
1032 | }
1033 | }
1034 | control.89 {
1035 | iface MIXER
1036 | name 'AIF1 AD1L Mixer AIF2 DACL Switch'
1037 | value false
1038 | comment {
1039 | access 'read write'
1040 | type BOOLEAN
1041 | count 1
1042 | }
1043 | }
1044 | control.90 {
1045 | iface MIXER
1046 | name 'AIF1 AD1L Mixer ADCL Switch'
1047 | value false
1048 | comment {
1049 | access 'read write'
1050 | type BOOLEAN
1051 | count 1
1052 | }
1053 | }
1054 | control.91 {
1055 | iface MIXER
1056 | name 'AIF1 AD0R Mixer AIF1 DA0R Switch'
1057 | value false
1058 | comment {
1059 | access 'read write'
1060 | type BOOLEAN
1061 | count 1
1062 | }
1063 | }
1064 | control.92 {
1065 | iface MIXER
1066 | name 'AIF1 AD0R Mixer AIF2 DACR Switch'
1067 | value false
1068 | comment {
1069 | access 'read write'
1070 | type BOOLEAN
1071 | count 1
1072 | }
1073 | }
1074 | control.93 {
1075 | iface MIXER
1076 | name 'AIF1 AD0R Mixer ADCR Switch'
1077 | value false
1078 | comment {
1079 | access 'read write'
1080 | type BOOLEAN
1081 | count 1
1082 | }
1083 | }
1084 | control.94 {
1085 | iface MIXER
1086 | name 'AIF1 AD0R Mixer AIF2 DACL Switch'
1087 | value false
1088 | comment {
1089 | access 'read write'
1090 | type BOOLEAN
1091 | count 1
1092 | }
1093 | }
1094 | control.95 {
1095 | iface MIXER
1096 | name 'AIF1 AD0L Mixer AIF1 DA0L Switch'
1097 | value false
1098 | comment {
1099 | access 'read write'
1100 | type BOOLEAN
1101 | count 1
1102 | }
1103 | }
1104 | control.96 {
1105 | iface MIXER
1106 | name 'AIF1 AD0L Mixer AIF2 DACL Switch'
1107 | value false
1108 | comment {
1109 | access 'read write'
1110 | type BOOLEAN
1111 | count 1
1112 | }
1113 | }
1114 | control.97 {
1115 | iface MIXER
1116 | name 'AIF1 AD0L Mixer ADCL Switch'
1117 | value false
1118 | comment {
1119 | access 'read write'
1120 | type BOOLEAN
1121 | count 1
1122 | }
1123 | }
1124 | control.98 {
1125 | iface MIXER
1126 | name 'AIF1 AD0L Mixer AIF2 DACR Switch'
1127 | value false
1128 | comment {
1129 | access 'read write'
1130 | type BOOLEAN
1131 | count 1
1132 | }
1133 | }
1134 | control.99 {
1135 | iface MIXER
1136 | name 'AIF1IN1R Mux'
1137 | value AIF1_DA1R
1138 | comment {
1139 | access 'read write'
1140 | type ENUMERATED
1141 | count 1
1142 | item.0 AIF1_DA1R
1143 | item.1 AIF1_DA1L
1144 | item.2 SUM_AIF1DA1L_AIF1DA1R
1145 | item.3 AVE_AIF1DA1L_AIF1DA1R
1146 | }
1147 | }
1148 | control.100 {
1149 | iface MIXER
1150 | name 'AIF1IN1L Mux'
1151 | value AIF1_DA1L
1152 | comment {
1153 | access 'read write'
1154 | type ENUMERATED
1155 | count 1
1156 | item.0 AIF1_DA1L
1157 | item.1 AIF1_DA1R
1158 | item.2 SUM_AIF1DA1L_AIF1DA1R
1159 | item.3 AVE_AIF1DA1L_AIF1DA1R
1160 | }
1161 | }
1162 | control.101 {
1163 | iface MIXER
1164 | name 'AIF1IN0R Mux'
1165 | value AIF1_DA0R
1166 | comment {
1167 | access 'read write'
1168 | type ENUMERATED
1169 | count 1
1170 | item.0 AIF1_DA0R
1171 | item.1 AIF1_DA0L
1172 | item.2 SUM_AIF1DA0L_AIF1DA0R
1173 | item.3 AVE_AIF1DA0L_AIF1DA0R
1174 | }
1175 | }
1176 | control.102 {
1177 | iface MIXER
1178 | name 'AIF1IN0L Mux'
1179 | value AIF1_DA0L
1180 | comment {
1181 | access 'read write'
1182 | type ENUMERATED
1183 | count 1
1184 | item.0 AIF1_DA0L
1185 | item.1 AIF1_DA0R
1186 | item.2 SUM_AIF1DA0L_AIF1DA0R
1187 | item.3 AVE_AIF1DA0L_AIF1DA0R
1188 | }
1189 | }
1190 | control.103 {
1191 | iface MIXER
1192 | name 'AIF1OUT1R Mux'
1193 | value AIF1_AD1R
1194 | comment {
1195 | access 'read write'
1196 | type ENUMERATED
1197 | count 1
1198 | item.0 AIF1_AD1R
1199 | item.1 AIF1_AD1L
1200 | item.2 SUM_AIF1ADC1L_AIF1ADC1R
1201 | item.3 AVE_AIF1ADC1L_AIF1ADC1R
1202 | }
1203 | }
1204 | control.104 {
1205 | iface MIXER
1206 | name 'AIF1OUT1L Mux'
1207 | value AIF1_AD1L
1208 | comment {
1209 | access 'read write'
1210 | type ENUMERATED
1211 | count 1
1212 | item.0 AIF1_AD1L
1213 | item.1 AIF1_AD1R
1214 | item.2 SUM_AIF1ADC1L_AIF1ADC1R
1215 | item.3 AVE_AIF1ADC1L_AIF1ADC1R
1216 | }
1217 | }
1218 | control.105 {
1219 | iface MIXER
1220 | name 'AIF1OUT0R Mux'
1221 | value AIF1_AD0R
1222 | comment {
1223 | access 'read write'
1224 | type ENUMERATED
1225 | count 1
1226 | item.0 AIF1_AD0R
1227 | item.1 AIF1_AD0L
1228 | item.2 SUM_AIF1AD0L_AIF1AD0R
1229 | item.3 AVE_AIF1AD0L_AIF1AD0R
1230 | }
1231 | }
1232 | control.106 {
1233 | iface MIXER
1234 | name 'AIF1OUT0L Mux'
1235 | value AIF1_AD0L
1236 | comment {
1237 | access 'read write'
1238 | type ENUMERATED
1239 | count 1
1240 | item.0 AIF1_AD0L
1241 | item.1 AIF1_AD0R
1242 | item.2 SUM_AIF1AD0L_AIF1AD0R
1243 | item.3 AVE_AIF1AD0L_AIF1AD0R
1244 | }
1245 | }
1246 | control.107 {
1247 | iface MIXER
1248 | name 'AIF2INR Mux VIR switch aif2inr aif3'
1249 | value false
1250 | comment {
1251 | access 'read write'
1252 | type BOOLEAN
1253 | count 1
1254 | }
1255 | }
1256 | control.108 {
1257 | iface MIXER
1258 | name 'AIF2INL Mux VIR switch aif2inl aif3'
1259 | value false
1260 | comment {
1261 | access 'read write'
1262 | type BOOLEAN
1263 | count 1
1264 | }
1265 | }
1266 | control.109 {
1267 | iface MIXER
1268 | name 'AIF2INR Mux switch aif2inr aif2'
1269 | value false
1270 | comment {
1271 | access 'read write'
1272 | type BOOLEAN
1273 | count 1
1274 | }
1275 | }
1276 | control.110 {
1277 | iface MIXER
1278 | name 'AIF2INL Mux switch aif2inl aif2'
1279 | value false
1280 | comment {
1281 | access 'read write'
1282 | type BOOLEAN
1283 | count 1
1284 | }
1285 | }
1286 | control.111 {
1287 | iface MIXER
1288 | name 'External Speaker Switch'
1289 | value true
1290 | comment {
1291 | access 'read write'
1292 | type BOOLEAN
1293 | count 1
1294 | }
1295 | }
1296 | control.112 {
1297 | iface MIXER
1298 | name 'Headphone Switch'
1299 | value false
1300 | comment {
1301 | access 'read write'
1302 | type BOOLEAN
1303 | count 1
1304 | }
1305 | }
1306 | control.113 {
1307 | iface MIXER
1308 | name 'Earpiece Switch'
1309 | value false
1310 | comment {
1311 | access 'read write'
1312 | type BOOLEAN
1313 | count 1
1314 | }
1315 | }
1316 | }
1317 | state.sndhdmi {
1318 | control.1 {
1319 | iface MIXER
1320 | name 'hdmi audio format Function'
1321 | value pcm
1322 | comment {
1323 | access 'read write'
1324 | type ENUMERATED
1325 | count 1
1326 | item.0 null
1327 | item.1 pcm
1328 | item.2 AC3
1329 | item.3 MPEG1
1330 | item.4 MP3
1331 | item.5 MPEG2
1332 | item.6 AAC
1333 | item.7 DTS
1334 | item.8 ATRAC
1335 | item.9 ONE_BIT_AUDIO
1336 | item.10 DOLBY_DIGITAL_PLUS
1337 | item.11 DTS_HD
1338 | item.12 MAT
1339 | item.13 WMAPRO
1340 | }
1341 | }
1342 | control.2 {
1343 | iface MIXER
1344 | name 'sunxi daudio audio hub mode'
1345 | value hub_disable
1346 | comment {
1347 | access 'read write'
1348 | type ENUMERATED
1349 | count 1
1350 | item.0 null
1351 | item.1 hub_disable
1352 | item.2 hub_enable
1353 | }
1354 | }
1355 | }
1356 |
--------------------------------------------------------------------------------
/pinebook/fix-battery-detection.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ "$(id -u)" != "0" ]; then
4 | echo "This script must be executed as root. Exiting" >&2
5 | exit 1
6 | fi
7 |
8 | cd /tmp
9 | wget -q https://raw.githubusercontent.com/armbian/u-boot-pine64-armbian/93722e878ece4a48cef3fe035e5b37e8d31cd84d/blobs/sun50i-a64-pine64-pinebook.dts
10 |
11 | #install device-tree-compiler if neccessary
12 | dpkg -l | grep -qw device-tree-compiler || apt-get install device-tree-compiler
13 |
14 | #backup old, compile new DTS
15 | cp -p /boot/pine64/sun50i-a64-pine64-pinebook.dtb /boot/pine64/sun50i-a64-pine64-pinebook.dtb.bak
16 | dtc -I dts -O dtb -o /boot/pine64/sun50i-a64-pine64-pinebook.dtb sun50i-a64-pine64-pinebook.dts
17 |
18 | echo -e "\nPlease reboot your Pinebook to allow the new PMIC settings be applied\n"
19 |
--------------------------------------------------------------------------------
/pinebook/fixed-wifi-mac.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ "$(id -u)" != "0" ]; then
4 | echo "This script must be executed as root. Exiting" >&2
5 | exit 1
6 | fi
7 |
8 | SSID=$(iwgetid -r)
9 | NET_DEVICE=$(iwgetid | awk -F ' ' '{print $1}')
10 | MAC=$(cat /sys/class/net/$NET_DEVICE/address)
11 |
12 | nmcli con modify "$SSID" wifi.cloned-mac-address $MAC
13 |
--------------------------------------------------------------------------------
/pinebook/headphone_detect.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Written 2017 by Peter Feerick, GPLv3 licensed
4 | #
5 | # Depends on evtest to function, run 'sudo apt install evtest'
6 | # on a debian based system to install if missing.
7 |
8 | LAST_HEADPHONE_STATE=2 #invalid value to guarantee first check
9 | LAST_MIC_STATE=2
10 |
11 | #check headphone jack state
12 | checkHeadphoneJackState() {
13 | evtest --query /dev/input/event2 EV_SW SW_HEADPHONE_INSERT
14 | HEADPHONE_STATE=$?
15 | }
16 |
17 | #check mic jack state
18 | checkMicJackState() {
19 | evtest --query /dev/input/event2 EV_SW SW_MICROPHONE_INSERT
20 | MIC_STATE=$?
21 | }
22 |
23 | while true ; do
24 |
25 | checkHeadphoneJackState
26 |
27 | if [ ! $HEADPHONE_STATE -eq $LAST_HEADPHONE_STATE ]; then
28 | if [ $HEADPHONE_STATE -eq 10 ]; then
29 | amixer -q set "External Speaker" mute
30 | else
31 | amixer -q set "External Speaker" unmute
32 | fi
33 | LAST_HEADPHONE_STATE=$HEADPHONE_STATE
34 | # echo "Headphone state:" $HEADPHONE_STATE
35 |
36 | fi
37 |
38 | # checkMicJackState
39 |
40 | # if [ ! $MIC_STATE -eq $LAST_MIC_STATE ]; then
41 | # if [ $MIC_STATE -eq 10 ]; then
42 | # else
43 | # fi
44 | # LAST_MIC_STATE=$HEADPHONE_STATE
45 | # echo "Mic state:" $MIC_STATE
46 |
47 | # fi
48 |
49 | sleep 0.2
50 | done
51 |
--------------------------------------------------------------------------------
/pinebook/no-speaker-fix.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Written by Peter Feerick, 2017
4 | # Licensed under the GPL v3
5 |
6 | # Fixes the issue with the currently shipped revision of the linux image on the
7 | # Pinbook not haveing any sound. If it doesn't work, the asound.state file can
8 | # be recovered from the /tmp directory.
9 |
10 | if [ "$(id -u)" != "0" ]; then
11 | echo "This script must be executed as root. Exiting" >&2
12 | exit 1
13 | fi
14 |
15 | unpackNoSoundFix ()
16 | {
17 | cd /var/lib/alsa && echo "H4sIAM/6AlkAA+1cS3OjOBDONfkVuuWUWQn8PJLYk1CLH0Xs2d0TRWySUGtDysYz2d
18 | qa/76SDAb0YrwD8oxrqFQMkhDfR7e6m5bA38a7aPlhm/hJcNHQBvHWabXoL96Y3zbsmPACmQjvdttGF5cjAyHzAsCmABW3Haa+Ae
19 | BiE8eJql1V/U+6UcF/8HfLMF7Ey2AB/r26XMRRsolXHxA5uAyf/UUARvafQxcfRf46ANeW/REBa3AHknAdbFdxAiD4HK926+Aat/
20 | nsr3bBBwjgYR/R/UW8XgdRQnu99BeLYLsF15vAX4IvmzChp14m/7wFwB7Phvf0cvicHT7DILsbP3rB14bgBhjtNm29fFqHEbhBqG
21 | +002P/HXQNCPdHGZJiiwzRoezrFfn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QgB/P
42 | DZCKMN+TWbjScQVC9ASdfc8OBWWsCpV4lkd46/a0bDwFQfGyncNf6ONQ5MHjUM35NgE/kr8Jh+3EBDGgcpvubxcPg6gY7AGSk+uj
43 | HMPlnRIJCvV/uP5W2j5etyHZKuqr+UR1vSz+uB53iz9hPwcRctkjAuvLD9tljXaRuj3WpVMIv73jODaBVeaTPBaDq8z09t4eO8tk
44 | 1rjcNxB1hW/r5eFwxmj4ejHrBmbqG2DybjoXdrzzxrPrAnORoIBhPn9i9vYN/bM8vxps487wVrPu7UexjkJQYYWbP80AR/jKypO+
45 | F0Q66j2130HoLlXgT7/6+7J7COl4WPaeASbxlu/afVUbpypCTKV8kkQkqDKC1MFe3q6tTfhfy1/dp+bee//QdELBrZAFgAAA==" | base64 -d | tar xzf -
46 | } #unpackNoSoundFix
47 |
48 | mv /var/lib/alsa/asound.state /tmp
49 |
50 | #download with curl was going to be original method of packaging fix
51 | #curl -s https://raw.githubusercontent.com/pfeerick/pine64-scripts/master/pinebook/asound.state > /var/lib/alsa/asound.state
52 |
53 | unpackNoSoundFix
54 |
55 | alsactl restore
56 |
57 | echo -e "\nTry your sound again now, there is no need to reboot your Pinebook.\n"
58 | echo -e "If it works, you can delete the asound.state file which was backed up"
59 | echo -e "to /tmp. Otherwise, you may want to restore that backup copy to "
60 | echo -e "/var/lib/alsa/asound.state and run 'alsactl restore' to reapply it.\n"
--------------------------------------------------------------------------------
/pinebook/pinebook-lcd-brightness-gpio.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Enable LCD Brightness GPIO access
3 | After=systemd-modules-load.service local-fs.target
4 |
5 | [Service]
6 | Type=oneshot
7 | ExecStart=/usr/local/bin/pinebook_lcd-brightness.sh -b
8 |
9 | [Install]
10 | WantedBy=multi-user.target
11 |
--------------------------------------------------------------------------------
/pinebook/pinebook_lcd-brightness.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Helper script for Pinebook mean to be used in conjunction with xbindkeys
4 | # Written 2017 Peter Feerick, GPLv3 licensed.
5 | #
6 | # Documentation for this script on GitHub
7 | # https://github.com/pfeerick/pine64-scripts/wiki/Pinebook-LCD-Brightness-script
8 |
9 | # Switch paths to twiddle depending on whether sunxidrm active or not
10 | if [ -d /sys/module/sunxidrm ]; then
11 | ACTUAL_BRIGHTNESS_PATH="/sys/devices/platform/sunxi-drm/backlight/lcd0/actual_brightness"
12 | MAX_BRIGHTNESS_PATH="/sys/devices/platform/sunxi-drm/backlight/lcd0/max_brightness"
13 | BRIGHTNESS_PATH="/sys/class/backlight/lcd0/brightness"
14 | else
15 | ACTUAL_BRIGHTNESS_PATH="/sys/class/backlight/lcd0/actual_brightness"
16 | MAX_BRIGHTNESS_PATH="/sys/class/backlight/lcd0/max_brightness"
17 | BRIGHTNESS_PATH="/sys/class/backlight/lcd0/brightness"
18 | fi
19 |
20 | # Check if required access permissions are available...
21 | if [ ! -r ${ACTUAL_BRIGHTNESS_PATH} ] || [ ! -r ${MAX_BRIGHTNESS_PATH} ] || [ ! -w ${BRIGHTNESS_PATH} ]; then
22 | echo "This script doesn't have the necessary permissions to read or change the LCD brightness!"
23 | echo "Changes to permisisons or running as a root user is required."
24 | exit 1
25 | fi
26 |
27 | MINIMUM_BRIGHTNESS=5
28 | MAXIMUM_BRIGHTNESS=$(<${MAX_BRIGHTNESS_PATH})
29 | ACTUAL_BRIGHTNESS=$(<${ACTUAL_BRIGHTNESS_PATH})
30 |
31 | while getopts ":i:d:s:vb" opt; do
32 | case $opt in
33 | i)
34 | NEW_BRIGHTNESS=$((ACTUAL_BRIGHTNESS + $OPTARG))
35 | echo "Increase the LCD backlight brightness by $OPTARG to $NEW_BRIGHTNESS"
36 | ;;
37 | d)
38 | NEW_BRIGHTNESS=$((ACTUAL_BRIGHTNESS - $OPTARG))
39 | echo "Decrease the LCD backlight brightness by $OPTARG to $NEW_BRIGHTNESS"
40 | ;;
41 | s)
42 | NEW_BRIGHTNESS=$OPTARG
43 | echo "Set the lcd backlight brightness to $OPTARG" >&2
44 | ;;
45 | v)
46 | echo "Minimum brightness: $MINIMUM_BRIGHTNESS, Maximum: $MAXIMUM_BRIGHTNESS"
47 | ;;
48 | b)
49 | chown root:gpio ${ACTUAL_BRIGHTNESS_PATH} ${MAX_BRIGHTNESS_PATH} ${BRIGHTNESS_PATH}
50 | chmod 664 ${ACTUAL_BRIGHTNESS_PATH} ${MAX_BRIGHTNESS_PATH} ${BRIGHTNESS_PATH}
51 | exit 0
52 | ;;
53 | \?)
54 | echo "Invalid option: -$OPTARG" >&2
55 | exit 1
56 | ;;
57 | :)
58 | echo "Option -$OPTARG requires an argument." >&2
59 | exit 1
60 | ;;
61 | esac
62 | done
63 |
64 | #no arguments, display current value only
65 | if [ $# -eq 0 ]; then
66 | echo "Current backlight brightness: $ACTUAL_BRIGHTNESS"
67 | exit 0
68 | fi
69 |
70 | #if we've gotten this far, sanity check setting and apply
71 | if [ ! -z ${NEW_BRIGHTNESS} ]; then
72 | if [[ ${NEW_BRIGHTNESS} != ?(-)+([0-9]) ]]; then
73 | echo "Integer input expected. '$NEW_BRIGHTNESS' is NOT an integer!"
74 | exit 1
75 | fi
76 |
77 | if [ ${NEW_BRIGHTNESS} -lt ${MINIMUM_BRIGHTNESS} ]; then
78 | echo "Below mimimum brightness threshold"
79 | exit 1
80 | fi
81 |
82 | if [ ${NEW_BRIGHTNESS} -gt ${MAXIMUM_BRIGHTNESS} ]; then
83 | echo "Above maximum brightness threshold"
84 | exit 1
85 | fi
86 |
87 | echo ${NEW_BRIGHTNESS} > ${BRIGHTNESS_PATH}
88 | fi
89 |
--------------------------------------------------------------------------------
/pinebook/pinebook_speaker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Easily mute or unmute pinebook speaker from the command line
3 | # Written 2017 Peter Feerick, GPL v3 licensed
4 |
5 | if [ "$1" == "mute" ]; then
6 | amixer -q -c 0 set "External Speaker" playback mute
7 | elif [ "$1" == "unmute" ]; then
8 | amixer -q -c 0 set "External Speaker" playback unmute
9 | else
10 | echo "Parameter '$1' not recognised!"
11 | echo "Valid paramters are 'mute' and 'unmute'"
12 | fi
13 |
--------------------------------------------------------------------------------
/pinebook/pinebook_touchpad.sh:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # touchpad.sh
3 | #
4 | # Mark H. Harris
5 | # 2014/08/07
6 | # 2017/06/19 (pinebook port)
7 | #
8 | # Enable or Disable the TouchPad based on xinput
9 | #
10 | # notes: assumes 'one' touchpad
11 | # assumes xinput see man xinput
12 | #
13 | # usage:
14 | # touchpad on|1 (enables)
15 | # touchpad off|0 (disables)
16 | #
17 | #
18 |
19 | # check if X server is accessible
20 | if ! xset q >/dev/null 2>&1; then
21 | echo "No X server at \$DISPLAY [$DISPLAY]... Aborting!!!" >&2
22 | exit 1
23 | fi
24 |
25 | # get the touchpad device number TDEVICE
26 | for line in $(xinput list |grep -i "hailuck" |grep -i "pointer"); do
27 | for word in $(echo $line |grep -i "id"); do
28 | TDEVICE=$(echo $word |cut -d'=' -f2)
29 | done
30 | done
31 |
32 | # get Device Enabled status for touchpad
33 | for line in $(xinput --list-props $TDEVICE |grep "Device Enabled"); do
34 | TPRESTAT=$(echo $line |cut -d':' -f2 |cut -d' ' -f2)
35 | done
36 |
37 | # set prestatus keyword based on numerical data
38 | if [ "$TPRESTAT" = "1" ]; then
39 | PSTATUS="enabled"
40 | elif [ "$TPRESTAT" = "0" ]; then
41 | PSTATUS="disabled"
42 | else
43 | PSTATUS="unknown"
44 | fi
45 |
46 | # get the touchpad name by device number
47 | TNAME=$(xinput list --name-only $TDEVICE)
48 |
49 | # turn enable or disable the device per input parms
50 | echo " "
51 | if [ "$1" = "on" ] || [ "$1" = "1" ]; then
52 | xinput --enable $TDEVICE
53 | echo "Enabling" $TNAME "ID="$TDEVICE "..."
54 | echo " "
55 | elif [ "$1" = "off" ] || [ "$1" = "0" ]; then
56 | xinput --disable $TDEVICE
57 | echo "Disabling" $TNAME "ID="$TDEVICE "..."
58 | echo " "
59 | else
60 | echo $TNAME "ID="$TDEVICE "(currently "$PSTATUS")"
61 | echo " "
62 | echo "touchpad on (enables)"
63 | echo "touchpad off (disables)"
64 | echo " "
65 | fi
66 |
67 | # get current Device Enabled status for touchpad
68 | for line in $(xinput --list-props $TDEVICE |grep "Device Enabled"); do
69 | TCURSTAT=$(echo $line |cut -d':' -f2 |cut -d' ' -f2)
70 | done
71 |
72 | # display status of touchpad if the status has changed
73 | if [ "$TCURSTAT" = "1" ]; then
74 | TSTATUS="enabled"
75 | elif [ "$TCURSTAT" = "0" ]; then
76 | TSTATUS="disabled"
77 | else
78 | TSTATUS="unknown"
79 | fi
80 | if [ $PSTATUS != $TSTATUS ]; then
81 | echo "Device Status:" $TNAME "ID="$TDEVICE "("$TSTATUS")"
82 | echo " "
83 | else
84 | echo "TouchPad Status ("$TSTATUS") Unchanged"
85 | echo " "
86 | fi
87 |
--------------------------------------------------------------------------------
/pinebook/restart-nm-applet.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | killall nm-applet >/dev/null 2>&1
3 | nm-applet >/dev/null 2>&1 &
4 |
--------------------------------------------------------------------------------
/pinebook/touchpadTamer.py:
--------------------------------------------------------------------------------
1 | # Touchpad Tamer python script posted by 'David' from the pine64 forums
2 | # URL: https://forum.pine64.org/showthread.php?tid=4916&pid=30496#pid30496
3 | #
4 | # To use, first make sure user is in input group
5 | # (i.e. usermod -aG input ) then you could:
6 | # * run manually from the a terminal window using python3
7 | # * run from ~/.xprofile
8 | # * run on Mate via System -> Preferences -> Personal -> Startup Applications
9 | #
10 | # Suggested command line and path:
11 | # /usr/bin/python3 /usr/local/bin/touchpadTamer.py
12 |
13 | import threading
14 | import time
15 | import os
16 | import struct
17 | import fcntl
18 | import subprocess
19 |
20 | # ioctl to get the device name of /dev/input/event*
21 | EVIOCGNAME = 0x82004506
22 | EVIOCGBIT = 0x81fe4520
23 |
24 | # Format for the linux /dev/input/event* events.
25 | # tv_sec, tv_usec, type, code, value
26 | EVENT_FMT = "llHHi"
27 |
28 | EV_SYN = 0x00
29 | EV_KEY = 0x01
30 | EV_REL = 0x02
31 | EV_ABS = 0x03
32 | EV_MSC = 0x04
33 | EV_SW = 0x05
34 | EV_LED = 0x11
35 | EV_SND = 0x12
36 | EV_REP = 0x14
37 | EV_FF = 0x15
38 | EV_PWR = 0x16
39 | EV_FF_STATUS = 0x17
40 |
41 | KEY_RESERVED = 0
42 | KEY_ESC = 1
43 | KEY_1 = 2
44 | KEY_2 = 3
45 | KEY_3 = 4
46 | KEY_4 = 5
47 | KEY_5 = 6
48 | KEY_6 = 7
49 | KEY_7 = 8
50 | KEY_8 = 9
51 | KEY_9 = 10
52 | KEY_0 = 11
53 | KEY_MINUS = 12
54 | KEY_EQUAL = 13
55 | KEY_BACKSPACE = 14
56 | KEY_TAB = 15
57 | KEY_Q = 16
58 | KEY_W = 17
59 | KEY_E = 18
60 | KEY_R = 19
61 | KEY_T = 20
62 | KEY_Y = 21
63 | KEY_U = 22
64 | KEY_I = 23
65 | KEY_O = 24
66 | KEY_P = 25
67 | KEY_LEFTBRACE = 26
68 | KEY_RIGHTBRACE = 27
69 | KEY_ENTER = 28
70 | KEY_LEFTCTRL = 29
71 | KEY_A = 30
72 | KEY_S = 31
73 | KEY_D = 32
74 | KEY_F = 33
75 | KEY_G = 34
76 | KEY_H = 35
77 | KEY_J = 36
78 | KEY_K = 37
79 | KEY_L = 38
80 | KEY_SEMICOLON = 39
81 | KEY_APOSTROPHE = 40
82 | KEY_GRAVE = 41
83 | KEY_LEFTSHIFT = 42
84 | KEY_BACKSLASH = 43
85 | KEY_Z = 44
86 | KEY_X = 45
87 | KEY_C = 46
88 | KEY_V = 47
89 | KEY_B = 48
90 | KEY_N = 49
91 | KEY_M = 50
92 | KEY_COMMA = 51
93 | KEY_DOT = 52
94 | KEY_SLASH = 53
95 | KEY_RIGHTSHIFT = 54
96 | KEY_KPASTERISK = 55
97 | KEY_LEFTALT = 56
98 | KEY_SPACE = 57
99 | KEY_CAPSLOCK = 58
100 | KEY_F1 = 59
101 | KEY_F2 = 60
102 | KEY_F3 = 61
103 | KEY_F4 = 62
104 | KEY_F5 = 63
105 | KEY_F6 = 64
106 | KEY_F7 = 65
107 | KEY_F8 = 66
108 | KEY_F9 = 67
109 | KEY_F10 = 68
110 | KEY_NUMLOCK = 69
111 | KEY_SCROLLLOCK = 70
112 | KEY_KP7 = 71
113 | KEY_KP8 = 72
114 | KEY_KP9 = 73
115 | KEY_KPMINUS = 74
116 | KEY_KP4 = 75
117 | KEY_KP5 = 76
118 | KEY_KP6 = 77
119 | KEY_KPPLUS = 78
120 | KEY_KP1 = 79
121 | KEY_KP2 = 80
122 | KEY_KP3 = 81
123 | KEY_KP0 = 82
124 | KEY_KPDOT = 83
125 |
126 | KEY_ZENKAKUHANKAKU = 85
127 | KEY_102ND = 86
128 | KEY_F11 = 87
129 | KEY_F12 = 88
130 | KEY_RO = 89
131 | KEY_KATAKANA = 90
132 | KEY_HIRAGANA = 91
133 | KEY_HENKAN = 92
134 | KEY_KATAKANAHIRAGANA = 93
135 | KEY_MUHENKAN = 94
136 | KEY_KPJPCOMMA = 95
137 | KEY_KPENTER = 96
138 | KEY_RIGHTCTRL = 97
139 | KEY_KPSLASH = 98
140 | KEY_SYSRQ = 99
141 | KEY_RIGHTALT = 100
142 | KEY_LINEFEED = 101
143 | KEY_HOME = 102
144 | KEY_UP = 103
145 | KEY_PAGEUP = 104
146 | KEY_LEFT = 105
147 | KEY_RIGHT = 106
148 | KEY_END = 107
149 | KEY_DOWN = 108
150 | KEY_PAGEDOWN = 109
151 | KEY_INSERT = 110
152 | KEY_DELETE = 111
153 | KEY_MACRO = 112
154 | KEY_MUTE = 113
155 | KEY_VOLUMEDOWN = 114
156 | KEY_VOLUMEUP = 115
157 | KEY_POWER = 116 # SC System Power Down
158 | KEY_KPEQUAL = 117
159 | KEY_KPPLUSMINUS = 118
160 | KEY_PAUSE = 119
161 | KEY_SCALE = 120 # AL Compiz Scale (Expose)
162 |
163 | KEY_KPCOMMA = 121
164 | KEY_HANGEUL = 122
165 | KEY_HANGUEL = KEY_HANGEUL
166 | KEY_HANJA = 123
167 | KEY_YEN = 124
168 | KEY_LEFTMETA = 125
169 | KEY_RIGHTMETA = 126
170 | KEY_COMPOSE = 127
171 |
172 | KEY_STOP = 128 # AC Stop
173 | KEY_AGAIN = 129
174 | KEY_PROPS = 130 # AC Properties
175 | KEY_UNDO = 131 # AC Undo
176 | KEY_FRONT = 132
177 | KEY_COPY = 133 # AC Copy
178 | KEY_OPEN = 134 # AC Open
179 | KEY_PASTE = 135 # AC Paste
180 | KEY_FIND = 136 # AC Search
181 | KEY_CUT = 137 # AC Cut
182 | KEY_HELP = 138 # AL Integrated Help Center
183 | KEY_MENU = 139 # Menu (show menu)
184 | KEY_CALC = 140 # AL Calculator
185 | KEY_SETUP = 141
186 | KEY_SLEEP = 142 # SC System Sleep
187 | KEY_WAKEUP = 143 # System Wake Up
188 | KEY_FILE = 144 # AL Local Machine Browser
189 | KEY_SENDFILE = 145
190 | KEY_DELETEFILE = 146
191 | KEY_XFER = 147
192 | KEY_PROG1 = 148
193 | KEY_PROG2 = 149
194 | KEY_WWW = 150 # AL Internet Browser
195 | KEY_MSDOS = 151
196 | KEY_COFFEE = 152 # AL Terminal Lock/Screensaver
197 | KEY_SCREENLOCK = KEY_COFFEE
198 | KEY_ROTATE_DISPLAY = 153 # Display orientation for e.g. tablets
199 | KEY_DIRECTION = KEY_ROTATE_DISPLAY
200 | KEY_CYCLEWINDOWS = 154
201 | KEY_MAIL = 155
202 | KEY_BOOKMARKS = 156 # AC Bookmarks
203 | KEY_COMPUTER = 157
204 | KEY_BACK = 158 # AC Back
205 | KEY_FORWARD = 159 # AC Forward
206 | KEY_CLOSECD = 160
207 | KEY_EJECTCD = 161
208 | KEY_EJECTCLOSECD = 162
209 | KEY_NEXTSONG = 163
210 | KEY_PLAYPAUSE = 164
211 | KEY_PREVIOUSSONG = 165
212 | KEY_STOPCD = 166
213 | KEY_RECORD = 167
214 | KEY_REWIND = 168
215 | KEY_PHONE = 169 # Media Select Telephone
216 | KEY_ISO = 170
217 | KEY_CONFIG = 171 # AL Consumer Control Configuration
218 | KEY_HOMEPAGE = 172 # AC Home
219 | KEY_REFRESH = 173 # AC Refresh
220 | KEY_EXIT = 174 # AC Exit
221 | KEY_MOVE = 175
222 | KEY_EDIT = 176
223 | KEY_SCROLLUP = 177
224 | KEY_SCROLLDOWN = 178
225 | KEY_KPLEFTPAREN = 179
226 | KEY_KPRIGHTPAREN = 180
227 | KEY_NEW = 181 # AC New
228 | KEY_REDO = 182 # AC Redo/Repeat
229 |
230 | KEY_F13 = 183
231 | KEY_F14 = 184
232 | KEY_F15 = 185
233 | KEY_F16 = 186
234 | KEY_F17 = 187
235 | KEY_F18 = 188
236 | KEY_F19 = 189
237 | KEY_F20 = 190
238 | KEY_F21 = 191
239 | KEY_F22 = 192
240 | KEY_F23 = 193
241 | KEY_F24 = 194
242 |
243 | KEY_PLAYCD = 200
244 | KEY_PAUSECD = 201
245 | KEY_PROG3 = 202
246 | KEY_PROG4 = 203
247 | KEY_DASHBOARD = 204 # AL Dashboard
248 | KEY_SUSPEND = 205
249 | KEY_CLOSE = 206 # AC Close
250 | KEY_PLAY = 207
251 | KEY_FASTFORWARD = 208
252 | KEY_BASSBOOST = 209
253 | KEY_PRINT = 210 # AC Print
254 | KEY_HP = 211
255 | KEY_CAMERA = 212
256 | KEY_SOUND = 213
257 | KEY_QUESTION = 214
258 | KEY_EMAIL = 215
259 | KEY_CHAT = 216
260 | KEY_SEARCH = 217
261 | KEY_CONNECT = 218
262 | KEY_FINANCE = 219 # AL Checkbook/Finance
263 | KEY_SPORT = 220
264 | KEY_SHOP = 221
265 | KEY_ALTERASE = 222
266 | KEY_CANCEL = 223 # AC Cancel
267 | KEY_BRIGHTNESSDOWN = 224
268 | KEY_BRIGHTNESSUP = 225
269 | KEY_MEDIA = 226
270 |
271 | KEY_SWITCHVIDEOMODE = 227 # Cycle between available video outputs (Monitor/LCD/TV-out/etc)
272 | KEY_KBDILLUMTOGGLE = 228
273 | KEY_KBDILLUMDOWN = 229
274 | KEY_KBDILLUMUP = 230
275 |
276 | KEY_SEND = 231 # AC Send
277 | KEY_REPLY = 232 # AC Reply
278 | KEY_FORWARDMAIL = 233 # AC Forward Msg
279 | KEY_SAVE = 234 # AC Save
280 | KEY_DOCUMENTS = 235
281 |
282 | KEY_BATTERY = 236
283 |
284 | KEY_BLUETOOTH = 237
285 | KEY_WLAN = 238
286 | KEY_UWB = 239
287 |
288 | KEY_UNKNOWN = 240
289 |
290 | KEY_VIDEO_NEXT = 241 # drive next video source
291 | KEY_VIDEO_PREV = 242 # drive previous video source
292 | KEY_BRIGHTNESS_CYCLE = 243 # brightness up, after max is min
293 | KEY_BRIGHTNESS_AUTO = 244 # Set Auto Brightness: manual, brightness control is off, rely on ambient
294 | KEY_BRIGHTNESS_ZERO = KEY_BRIGHTNESS_AUTO
295 | KEY_DISPLAY_OFF = 245 # display device to off state
296 |
297 | KEY_WWAN = 246 # Wireless WAN (LTE, UMTS, GSM, etc.)
298 | KEY_WIMAX = KEY_WWAN
299 | KEY_RFKILL = 247 # Key that controls all radios
300 |
301 | KEY_MICMUTE = 248 # Mute / unmute the microphone
302 |
303 |
304 | class TouchpadHack:
305 | def __init__(self):
306 | self.__disabled = False
307 | self.__condition = threading.Condition()
308 | self.__disabled_until_time = time.monotonic()
309 | self.__running = True
310 |
311 | self.__disable_timeout = 0.5
312 | self.__timeout_thread = threading.Thread(target=self.timeoutThread, daemon=True)
313 |
314 | def findXInputDeviceNumber(self):
315 | res = subprocess.run(["/usr/bin/xinput", "list"], stdout=subprocess.PIPE).stdout
316 | for line in res.split(b"\n"):
317 | if b"pointer" in line and b"HAILUCK" in line:
318 | line = line[line.find(b"id=")+3:]
319 | line = line[:line.find(b"\t")]
320 | return int(line)
321 | return None
322 |
323 | def timeoutThread(self):
324 | device_number = self.findXInputDeviceNumber()
325 | while self.__running:
326 | with self.__condition:
327 | self.__condition.wait()
328 | os.system("xinput disable %d" % (device_number))
329 | print("disable")
330 | while time.monotonic() < self.__disabled_until_time and self.__running:
331 | time.sleep(self.__disabled_until_time - time.monotonic())
332 | os.system("xinput enable %d" % (device_number))
333 | print("enable")
334 |
335 | def inputReadThread(self):
336 | self.__timeout_thread.start()
337 |
338 | # Search for the first Pinebook keyboard entry. The first seems to be the keyboard, the 2nd the mouse.
339 | for event_path in sorted(os.listdir("/dev/input")):
340 | if not event_path.startswith("event"):
341 | continue
342 | event_path = os.path.join("/dev/input", event_path)
343 | f = open(event_path, "rb")
344 | input_device_name = bytearray(512)
345 | fcntl.ioctl(f, EVIOCGNAME, input_device_name, True)
346 | input_device_name = input_device_name[:input_device_name.find(b"\0")].decode("utf-8")
347 | if input_device_name == "HAILUCK CO.,LTD USB KEYBOARD":
348 | break
349 | f.close()
350 |
351 | try:
352 | while True:
353 | # We read events here from the keyboard and then just ignore them.
354 | # The only thing we care about is that an event happens.
355 | event = f.read(struct.calcsize(EVENT_FMT))
356 | tv_sec, tv_usec, etype, code, value = struct.unpack(EVENT_FMT, event)
357 | if etype == EV_KEY and self.isDisableKey(code):
358 | self.initiateOrUpdateDisable()
359 | except KeyboardInterrupt:
360 | self.__running = False
361 | print("Shutting down")
362 | with self.__condition:
363 | self.__condition.notify()
364 | self.__timeout_thread.join()
365 |
366 | def isDisableKey(self, code):
367 | # Don't react to modifier keys
368 | if code == KEY_LEFTALT or code == KEY_RIGHTALT:
369 | return False
370 | if code == KEY_LEFTCTRL or code == KEY_RIGHTCTRL:
371 | return False
372 | if code == KEY_LEFTSHIFT or code == KEY_RIGHTSHIFT:
373 | return False
374 | if code == KEY_LEFTMETA or code == KEY_RIGHTMETA:
375 | return False
376 | return True
377 |
378 | def initiateOrUpdateDisable(self):
379 | with self.__condition:
380 | self.__condition.notify()
381 | self.__disabled_until_time = time.monotonic() + self.__disable_timeout
382 |
383 | TouchpadHack().inputReadThread()
384 |
--------------------------------------------------------------------------------
/pinephone/manjaro/batteryChecker.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Run batteryChecker LED notification script
3 |
4 | [Service]
5 | ExecStart=/usr/local/sbin/batteryChecker.sh -d
6 | KillSignal=SIGINT
7 |
8 | [Install]
9 | WantedBy=multi-user.target
10 |
--------------------------------------------------------------------------------
/pinephone/manjaro/batteryChecker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #get device model
4 | if [ -f /proc/device-tree/model ]; then
5 | IFS= read -r -d '' DEVICE_MODEL &2
67 | echo -ne "Either run this script via sudo, or alter the write permissions for\n" 1>&2
68 | echo -ne "* ${RED_LED}\n" 1>&2
69 | echo -ne "* ${GREEN_LED}\n" 1>&2
70 | echo -ne "* ${BLUE_LED}\n" 1>&2
71 | exit 1
72 | fi
73 | } # CheckIfWritable
74 |
75 | ParseOptions() {
76 | while getopts ':hHw:dl:u:' opt ; do
77 | case ${opt} in
78 | h|H)
79 | DisplayUsage
80 | exit 0
81 | ;;
82 | w)
83 | MODE=2
84 | WAIT_TIME=${OPTARG}
85 | ;;
86 | l)
87 | LED_ONTIME=${OPTARG}
88 | ;;
89 | u)
90 | LED_OFFTIME=${OPTARG}
91 | ;;
92 | d)
93 | MODE=3
94 | ;;
95 | \?)
96 | echo "Invalid option: ${OPTARG}" 1>&2
97 | exit 1
98 | ;;
99 | :)
100 | echo "Invalid option: ${OPTARG} requires an argument." 1>&2
101 | exit 1
102 | ;;
103 | esac
104 | done
105 | shift $((OPTIND -1))
106 | } # ParseOptions
107 |
108 | DisplayUsage() {
109 | echo -ne "Usage: ${0##*/} [-h] [-w interval] [-d] [-l interval] [-u interval]\n"
110 | echo -ne "############################################################################\n"
111 | echo -ne "Use batteryChecker for the following tasks:\n"
112 | echo -ne " -w provides battery information every specified interval (seconds)\n"
113 | echo -ne " -d provides a simple battery status led notifier\n"
114 | echo -ne " -l sets a custom 'lit' led time (in seconds, default: ${LED_ONTIME})\n"
115 | echo -ne " -u sets a custom 'unlit' led time (in seconds, default: ${LED_OFFTIME})\n"
116 | echo -ne " -h displays this help screen\n"
117 | echo -ne "############################################################################\n"
118 | } # DisplayUsage
119 |
120 |
121 | AllOff() {
122 | if [ -w ${RED_LED} ]; then
123 | echo 0 > ${RED_LED}
124 | fi
125 | if [ -w ${GREEN_LED} ]; then
126 | echo 0 > ${GREEN_LED}
127 | fi
128 | if [ -w ${BLUE_LED} ]; then
129 | echo 0 > ${BLUE_LED}
130 | fi
131 | } # AllOff
132 |
133 | CheckBattery() {
134 | BATT_PRESENT=$(<${BATT_PATH}/present)
135 |
136 | if [ "$BATT_PRESENT" = "1" ]; then
137 | BATT_STATUS=$(<${BATT_PATH}/status)
138 |
139 | if command -v "bc" >/dev/null 2>&1 ; then
140 | BATT_VOLTAGE=$(<${BATT_PATH}/voltage_now)
141 | BATT_VOLTAGE=$(echo " (($BATT_VOLTAGE/10000)*0.01 ) "|bc)
142 | else
143 | BATT_VOLTAGE=$(awk '{printf ("%0.2f",$1/1000000); }' <${BATT_PATH}/voltage_now)
144 | fi
145 |
146 | BATT_CURRENT=$(<${BATT_PATH}/current_now)
147 | ((BATT_CURRENT = BATT_CURRENT / 1000))
148 | BATT_CAPACITY=$(<${BATT_PATH}/capacity)
149 | BATT_HEALTH=$(<${BATT_PATH}/health)
150 | fi
151 | } # CheckBattery
152 |
153 | LedBatteryStatus() {
154 | if [ "$BATT_PRESENT" = "1" ]; then
155 | if [ "${BATT_CAPACITY}" -gt 66 ]; then
156 | echo 0 > $RED_LED
157 | echo 1 > $GREEN_LED
158 | echo 0 > $BLUE_LED
159 | elif [ "${BATT_CAPACITY}" -gt 33 ]; then
160 | echo 1 > $RED_LED
161 | echo 1 > $GREEN_LED
162 | echo 0 > $BLUE_LED
163 | else
164 | echo 1 > $RED_LED
165 | echo 0 > $GREEN_LED
166 | echo 0 > $BLUE_LED
167 | fi
168 | fi
169 | } # LedBatteryStatus
170 |
171 | DisplayBatteryStatus() {
172 | if [ "$BATT_PRESENT" = "1" ]; then
173 | echo "${DEVICE_MODEL} battery detected!"
174 | echo "Status: ${BATT_STATUS}"
175 | echo "Voltage: ${BATT_VOLTAGE}v"
176 | echo "Current: ${BATT_CURRENT}ma"
177 | echo "Capacity: ${BATT_CAPACITY}%"
178 | echo "Health: ${BATT_HEALTH}"
179 | else
180 | echo "${DEVICE_MODEL} battery not detected!"
181 | fi
182 | } # DisplayBatteryStatus
183 |
184 | #InstallSystemdUnit() {
185 | #/etc/systemd/system/
186 | #/usr/lib/systemd/system/
187 | #} # InstallSystemdUnit
188 |
189 | Main "$@"
190 |
--------------------------------------------------------------------------------
/pinephone/manjaro/fix-no-backlight.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Ensure backlight brightness is above minimum value
3 | After=systemd-backlight@backlight:backlight.service
4 |
5 | [Service]
6 | Type=oneshot
7 | ExecStart=/usr/local/sbin/fix-no-backlight.sh
8 |
9 | [Install]
10 | WantedBy=multi-user.target
11 |
--------------------------------------------------------------------------------
/pinephone/manjaro/fix-no-backlight.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ "$(id -u)" != "0" ]; then
4 | echo -ne "This script must be executed as root. Exiting\n" >&2
5 | exit 1
6 | fi
7 |
8 | # value below 3 results in no backlight
9 | echo 3 > /sys/class/backlight/backlight/brightness
10 |
--------------------------------------------------------------------------------
/pinephone/manjaro/readme.md:
--------------------------------------------------------------------------------
1 | Scripts developed whilst playing with the Manjaro ARM pinephone distribution.
2 |
--------------------------------------------------------------------------------
/pinephone/manjaro/wifi-power-management.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | MODE="none"
4 |
5 | Main() {
6 | ParseOptions "$@"
7 |
8 | if [ $# -eq 0 ] || [ ${MODE} == "none" ]; then
9 | echo "Specify a power saving mode!!!"
10 | echo " -0 = disable"
11 | echo " -1 = minimum power saving"
12 | echo " -2 = maximum power saving"
13 | echo " -s = show current setting"
14 | exit 1
15 |
16 | fi
17 |
18 | case "${MODE}" in
19 | 0) #0 = disable power saving
20 | CheckRoot
21 | echo 0 > /sys/module/8723cs/parameters/rtw_power_mgnt
22 | echo 0 > /sys/module/8723cs/parameters/rtw_ips_mode
23 | exit 0
24 | ;;
25 | 1) #1 = power saving on, minPS
26 | CheckRoot
27 | echo 1 > /sys/module/8723cs/parameters/rtw_power_mgnt
28 | echo 1 > /sys/module/8723cs/parameters/rtw_ips_mode
29 | exit 0
30 | ;;
31 | 2) #2 = power saving on, maxPS
32 | CheckRoot
33 | echo 2 > /sys/module/8723cs/parameters/rtw_power_mgnt
34 | echo 1 > /sys/module/8723cs/parameters/rtw_ips_mode
35 | exit 0
36 | ;;
37 | s) #show current setting
38 | RTW_POWER_MGNT=$(&2
67 | exit 1
68 | ;;
69 | :)
70 | echo "Invalid option: ${OPTARG} requires an argument." 1>&2
71 | exit 1
72 | ;;
73 | esac
74 | done
75 | shift $((OPTIND -1))
76 | } # ParseOptions
77 |
78 | #check for root priv
79 | CheckRoot() {
80 | if [ "$(id -u)" != "0" ]; then
81 | echo -ne "This script must be executed as root. Exiting\n" >&2
82 | exit 1
83 | fi
84 | } # CheckRoot
85 |
86 |
87 |
88 | Main "$@"
89 |
--------------------------------------------------------------------------------
/restart-nm-applet.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | killall nm-applet >/dev/null 2>&1
3 | nm-applet >/dev/null 2>&1 &
4 |
--------------------------------------------------------------------------------
/testing/gpio-input-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | RootCheck() {
4 | if [ "$(id -u)" != "0" ]; then
5 | echo "${0##*/} requires root privleges - run as root or through sudo. Exiting" >&2
6 | exit 1
7 | fi
8 | }
9 |
10 | usage() {
11 | echo "Usage:"
12 | echo "$ $0 [-in]"
13 | echo ""
14 | echo " gpio - gpio number to test"
15 | echo ""
16 | echo " -in - set the direction to be 'in'"
17 | echo ""
18 | exit 1
19 | }
20 |
21 | cleanup() {
22 | echo "CTRL-C pressed!"
23 | echo ${GPIO_NUM} > "${GPIO_PATH}/unexport"
24 | exit 0
25 | }
26 |
27 | if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
28 | usage
29 | fi
30 |
31 | RootCheck
32 |
33 | #catch Ctrl+C
34 | trap cleanup 2
35 |
36 | GPIO_NUM="$1"
37 | GPIO_PATH="/sys/class/gpio/"
38 |
39 | test ! -e ${GPIO_PATH}${GPIO_NUM} && echo 73 > "/sys/class/gpio/export"
40 |
41 | if [[ $2 == "-in" ]]; then
42 | echo -ne "'direction' of GPIO #${GPIO_NUM} is currently "
43 | cat ${GPIO_PATH}/gpio${GPIO_NUM}/direction
44 | echo "Setting direction to 'in'..."
45 | echo in > ${GPIO_PATH}/gpio${GPIO_NUM}/direction
46 | fi
47 |
48 | while true; do
49 | echo -ne "value of GPIO #${GPIO_NUM}: "
50 | cat ${GPIO_PATH}${GPIO_NUM}/value
51 | sleep 1
52 | done
53 |
--------------------------------------------------------------------------------
/testing/quickcputest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | Main() {
4 | RootCheck
5 | [ -f cpuburn ] || PrepareCpuBurn
6 |
7 | ./cpuburn &
8 | PROC_ID=$!
9 |
10 | trap Finish 2
11 |
12 | while kill -0 "$PROC_ID" >/dev/null 2>&1; do
13 | MonitorMode
14 | done
15 | }
16 |
17 | Finish() {
18 | echo -e "\n'Ctrl+C' detected. Killing any cpuburn processes..."
19 | kill -9 $(pidof cpuburn)
20 | exit 0
21 | }
22 |
23 | RootCheck() {
24 | if [ "$(id -u)" != "0" ]; then
25 | echo "${0##*/} requires root privleges - run as root or through sudo. Exiting" >&2
26 | exit 1
27 | fi
28 | }
29 |
30 | PrepareCpuBurn() {
31 | echo "Downloading and compiling cpuburn-a53 ... "
32 | curl -LO https://raw.githubusercontent.com/ssvb/cpuburn-arm/master/cpuburn-a53.S
33 | gcc -o cpuburn cpuburn-a53.S
34 | }
35 |
36 | #display stats - ripped from armbianmonitor monitor mode
37 | MonitorMode() {
38 | DisplayHeader="Time CPUInfo Scaling"
39 | CPUs=normal
40 | [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ] && DisplayHeader="${DisplayHeader} CPU" || SocTemp='n/a'
41 | echo -e "${DisplayHeader}\c"
42 | Counter=0
43 | while true ; do
44 | let Counter++
45 | if [ ${Counter} -eq 15 ]; then
46 | echo -e "\n${DisplayHeader}\c"
47 | Counter=0
48 | fi
49 |
50 | CpuinfoCpuFreq=$(awk '{printf ("%0.0f",$1/1000); }' /dev/null
51 | ScalingCpuFreq=$(awk '{printf ("%0.0f",$1/1000); }' /dev/null
52 |
53 | echo -e "\n$(date "+%H:%M:%S"): $(printf "%4s" ${CpuinfoCpuFreq})MHz \t$(printf "%4s"MHz ${ScalingCpuFreq}) \c"
54 | if [ "X${SocTemp}" != "Xn/a" ]; then
55 | read SocTemp