summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-12-22 18:16:55 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-12-26 00:52:24 +0100
commita366c26466209675629e0ec8940623cfd9661ab7 (patch)
tree9a4c81e7eabcabc90ce6ca8124339ff5674aaab2
parent536bb1c072bd45c1172ec06162a0427308db47ca (diff)
downloadpresentations-a366c26466209675629e0ec8940623cfd9661ab7.tar.gz
presentations-a366c26466209675629e0ec8940623cfd9661ab7.tar.bz2
presentations-a366c26466209675629e0ec8940623cfd9661ab7.zip
Add script to print devices with removable batteries
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--.gitmodules3
-rw-r--r--36c3/Replicant_sustainability/Replicant_sustainability.tex24
-rwxr-xr-x36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py133
m---------external_resources/lineage_wiki0
4 files changed, 160 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index 1986570..8120fbd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "Replicant_contributors_meeting_27_28_July_2019_Paris_France/bootloaders/replicant_website"]
path = external_resources/replicant_website
url = https://git.replicant.us/replicant/website.git
+[submodule "external_resources/lineage_wiki"]
+ path = external_resources/lineage_wiki
+ url = git://github.com/LineageOS/lineage_wiki.git
diff --git a/36c3/Replicant_sustainability/Replicant_sustainability.tex b/36c3/Replicant_sustainability/Replicant_sustainability.tex
index 91d1070..ae5a3cb 100644
--- a/36c3/Replicant_sustainability/Replicant_sustainability.tex
+++ b/36c3/Replicant_sustainability/Replicant_sustainability.tex
@@ -143,6 +143,30 @@
\end{itemize}
\end{frame}
+\section{The dylema}
+
+\begin{frame}
+ \center{From a purely sustainable perspective:}
+ \begin{xtabular}{ll}
+ Big brand old devices & Big brand new devices \\
+ Removable battery & Battery too difficult to replace \\
+ Device specific kernel & Device specific modules \\
+ Changing HAL API & HAL API being versioned \\
+ \end{xtabular}
+\end{frame}
+
+\begin{frame}
+ \center{If we look at LineageOS:}
+ \begin{itemize}
+ \item SOCs, WiFi chips, smartphones and tablets
+ \item Write the code that work as fast as possible
+ \item Support as many hardware features as possible
+ \item $\rightarrow$ Varying code quality
+ \item $\rightarrow$ Example: One driver rewritten 3 times %% TODO: reference
+ \item Breaking Kernel API and ABI
+ \end{itemize}
+\end{frame}
+
%% \begin{frame}
%% Licenses:
%% \begin{itemize}
diff --git a/36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py b/36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py
new file mode 100755
index 0000000..d94499b
--- /dev/null
+++ b/36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py
@@ -0,0 +1,133 @@
+#!/bin/env python
+# Program to find devices to support in LineageOS
+# Copyright (C) 2019 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import re
+import sys
+import yaml
+
+basedir = '_data' + os.sep + 'devices'
+results = {}
+last_lineageos_version = 16.0
+
+def still_supported(document):
+ if not last_lineageos_version in document['versions']:
+ return False
+ if 'discontinued' in document['channels']:
+ return False
+
+ return True
+
+def interesting_for_sustainability(document):
+ # Non removable batteries are not sustainable
+ removable_battery = None
+ battery = document.get('battery', {})
+ if type(battery) is not list:
+ removable_battery = battery.get('removable', None)
+ if removable_battery == None:
+ return False
+ elif removable_battery == False:
+ return False
+ else:
+ for battery_version in battery:
+ nr_removable = 0
+ nr_not_removable = 0
+ removable = battery_version.get('removable', None)
+ if removable == None:
+ return False
+ elif removable == True:
+ nr_removable += 1
+ elif removable == False:
+ nr_not_removable += 1
+
+ if nr_removable == 0 and nr_not_removable > 0:
+ return False
+ elif nr_not_removable == 0 and nr_removable > 0:
+ return True
+ else:
+ print("TODO: The data has removable and non-removable batteries versions for the same device:" + battery)
+ print(" Add support for it in the parsing code")
+ sys.exit(1)
+ return True
+ return True
+
+def store_infos(results, document):
+ fields = ['vendor', 'name', 'type']
+
+ device_dict = {}
+ for field in fields:
+ device_dict[field] = document[field]
+
+ removable_battery = None
+ battery = document.get('battery', {})
+ if type(battery) is not list:
+ removable_battery = battery.get('removable', None)
+ else:
+ print(battery)
+ if removable_battery == None:
+ device_dict['removable_battery'] = 'Unknown'
+ else:
+ device_dict['removable_battery'] = removable_battery
+
+ soc = document['soc']
+ if not soc in results:
+ results[soc] = []
+
+ results[soc].append(device_dict)
+
+def print_results(results):
+ socs = list(results.keys())
+ socs.sort()
+
+ formfactors = []
+ for soc in socs:
+ for device in results[soc]:
+ if device['type'] not in formfactors:
+ formfactors.append(device['type'])
+
+ if len(formfactors) == 1:
+ print("{0}:".format(formfactors[0][0].capitalize() + formfactors[0][1:] + 's'))
+ for soc in socs:
+ print ("- {0}:".format(soc))
+ for device in results[soc]:
+ print (" * {0}: {1}".format(device['vendor'], device['name']))
+ else:
+ for soc in socs:
+ print ("{0}:".format(soc))
+ for device in results[soc]:
+ print ("- {0}: {1} ({2})".format(device['vendor'], device['name'], device['type']))
+
+def find_devices(path):
+ for filename in os.listdir(path + os.sep + basedir):
+ filepath = path + os.sep + basedir + os.sep + filename
+ if re.search("\.yml$", filepath):
+ yaml_file = open(filepath, 'r')
+ document = yaml.load(yaml_file)
+ if still_supported(document) and interesting_for_sustainability(document):
+ store_infos(results, document)
+ print_results(results)
+
+def usage(argv0):
+ progname = os.path.basename(argv0)
+ print("{} [path/to/lineage_wiki]".format(progname))
+ sys.exit(1)
+
+if len(sys.argv) != 2:
+ usage(sys.argv[0])
+
+find_devices(sys.argv[1])
+
diff --git a/external_resources/lineage_wiki b/external_resources/lineage_wiki
new file mode 160000
+Subproject 065f4989b7aceafdcad091ec6e76770989ff21f