Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
coon
firmware
Commits
eca5177f
Commit
eca5177f
authored
5 years ago
by
Renze
Browse files
Options
Downloads
Patches
Plain Diff
Add listing of ELF files
parent
8c0200dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/menu.py
+17
-3
17 additions, 3 deletions
preload/menu.py
with
17 additions
and
3 deletions
preload/menu.py
+
17
−
3
View file @
eca5177f
...
@@ -12,6 +12,16 @@ import os
...
@@ -12,6 +12,16 @@ import os
import
ujson
import
ujson
import
sys
import
sys
def
create_folders
():
try
:
os
.
mkdir
(
"
/apps
"
)
except
:
pass
try
:
os
.
mkdir
(
"
/elf
"
)
except
:
pass
def
read_metadata
(
app_folder
):
def
read_metadata
(
app_folder
):
try
:
try
:
info_file
=
"
/apps/%s/metadata.json
"
%
(
app_folder
)
info_file
=
"
/apps/%s/metadata.json
"
%
(
app_folder
)
...
@@ -28,10 +38,13 @@ def list_apps():
...
@@ -28,10 +38,13 @@ def list_apps():
apps
=
[]
apps
=
[]
for
appFolder
in
appFolders
:
for
appFolder
in
appFolders
:
apps
.
append
([
appFolder
,
read_metadata
(
appFolder
)])
apps
.
append
([
"
/apps/%s/__init__.py
"
%
appFolder
,
read_metadata
(
appFolder
)])
return
apps
for
elfFile
in
sorted
(
os
.
listdir
(
"
/elf
"
)):
if
elfFile
.
endswith
(
"
.elf
"
):
apps
.
append
([
"
/elf/%s
"
%
elfFile
,
{
'
author
'
:
''
,
'
name
'
:
"
ELF:
"
+
elfFile
[:
-
4
],
'
description
'
:
''
,
'
category
'
:
''
,
'
revision
'
:
0
}])
return
apps
def
button_events
():
def
button_events
():
"""
Iterate over button presses (event-loop).
"""
"""
Iterate over button presses (event-loop).
"""
...
@@ -75,6 +88,7 @@ def draw_menu(disp, applist, idx, offset):
...
@@ -75,6 +88,7 @@ def draw_menu(disp, applist, idx, offset):
def
main
():
def
main
():
create_folders
()
disp
=
display
.
open
()
disp
=
display
.
open
()
applist
=
list_apps
()
applist
=
list_apps
()
numapps
=
len
(
applist
)
numapps
=
len
(
applist
)
...
@@ -112,7 +126,7 @@ def main():
...
@@ -112,7 +126,7 @@ def main():
disp
.
clear
().
update
()
disp
.
clear
().
update
()
disp
.
close
()
disp
.
close
()
try
:
try
:
os
.
exec
(
"
/apps/%s/__init__.py
"
%
applist
[
current
][
0
])
os
.
exec
(
applist
[
current
][
0
])
except
OSError
as
e
:
except
OSError
as
e
:
print
(
"
Loading failed:
"
,
e
)
print
(
"
Loading failed:
"
,
e
)
os
.
exit
(
1
)
os
.
exit
(
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment