summaryrefslogtreecommitdiffstats
path: root/research/find_lineageos_devices.py
diff options
context:
space:
mode:
Diffstat (limited to 'research/find_lineageos_devices.py')
-rwxr-xr-xresearch/find_lineageos_devices.py94
1 files changed, 94 insertions, 0 deletions
diff --git a/research/find_lineageos_devices.py b/research/find_lineageos_devices.py
new file mode 100755
index 0000000..cb388ca
--- /dev/null
+++ b/research/find_lineageos_devices.py
@@ -0,0 +1,94 @@
+#!/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 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_replicant(document):
+ # For smartphones or tablets with a modem, since the modem is in
+ # the same SOC, we would need to do some extensive review of the SOC
+ # architecture to understand if the modem can be isolated with an IOMMU
+ # We would also need to make sure that the IOMMU is correctly setup (hard)
+ # and that the setup happens before the modem core are booted.
+ # For devices without a modem, we would still need to make sure that the
+ # sound card and the microphone is completely under the control of free
+ # software and that there aren't too much proprietary libraries to replace
+ if re.search("Qualcomm", document['soc']):
+ return False
+
+ # Non removable batteries causes too much issues for both users
+ # and developers as once you buy a device second hand, the battery
+ # doesn't last as much as when the device is new. On some devices,
+ # replicing non-replacable batteries can be very difficult and damage
+ # the device along the way
+ removable_battery = document.get('battery', {}).get('removable', None)
+ if removable_battery == None:
+ pass # Unknown
+ elif removable_battery == False:
+ return False
+
+ return True
+
+def store_infos(results, document):
+ fields = ['vendor', 'name', 'type']
+
+ device_dict = {}
+ for field in fields:
+ device_dict[field] = document[field]
+
+ removable_battery = document.get('battery', {}).get('removable', None)
+ 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()
+ for soc in socs:
+ print ("{0}:".format(soc))
+ for device in results[soc]:
+ print ("- {0}:".format(device))
+
+for filename in os.listdir(basedir):
+ filepath = 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_replicant(document):
+ store_infos(results, document)
+
+print_results(results)