From: Bdale Garbee Date: Mon, 11 Oct 2021 03:42:53 +0000 (-0600) Subject: Merge branch 'branch-1.9' into debian X-Git-Tag: debian/1.9.10-1~1 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9137f4ccde6ebc7be48edd2eb240470a9c242bac;hp=1f2db6b13e1a4251751a69e7ab73a4393d48cda5;p=fw%2Faltos Merge branch 'branch-1.9' into debian --- diff --git a/ChangeLog b/ChangeLog index eb720371..4535447b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,105 @@ +commit ed267e76eb03c34ec233c33a002ec9e5e53ec83a +Merge: bd71c839 ef70f80b +Author: Bdale Garbee +Date: Sun Oct 10 21:41:50 2021 -0600 + + Merge branch 'master' into branch-1.9 + +commit ef70f80b324e9c8ba7046b5000e0f28f77a54f8c +Author: Keith Packard +Date: Sun Oct 10 09:57:45 2021 -0700 + + Version 1.9.10 + + Signed-off-by: Keith Packard + +commit 67a1d9b5bcd9bd7dd4156010264cef6b9c87caa3 +Author: Keith Packard +Date: Sun Oct 10 09:49:49 2021 -0700 + + altos/telemega-v5.0: Add .gitignore + + Signed-off-by: Keith Packard + +commit 47d7affffdf97188a034bb48918ec22f03ea5b38 +Author: Keith Packard +Date: Sun Oct 10 09:47:52 2021 -0700 + + doc: Version 1.9.10 notes + + Signed-off-by: Keith Packard + +commit eb39995ded6b564efcb5a5312119d2672b437bc8 +Author: Keith Packard +Date: Sat Oct 9 21:32:17 2021 -0700 + + altosdroid: Catch log file open failures and show an error dialog + + Android changed which directories we can write to once, let's hope it + doesn't happen again. + + Signed-off-by: Keith Packard + +commit 3488d86de2e114a46e59bd4d2a2d7b95bf633963 +Author: Keith Packard +Date: Sat Oct 9 21:31:24 2021 -0700 + + altoslib: Add callback from AltosLog on file open failure + + This lets the UI tell the user that logging isn't working. + + Signed-off-by: Keith Packard + +commit 4b3ccb73a26f91917d327558295506ce3c02d684 +Author: Keith Packard +Date: Sat Oct 9 20:58:26 2021 -0700 + + altosdroid: Switch storage to media dir + + Even with the WRITE_EXTERNAL_STORAGE permission, we appear to no + longer have permission to write to a random external storage + dir. Instead, we only have permission to write to an app-specific dir, + buried deep in the directory tree. We can get that directory name with + getExternalMediaDirs()[0]. + + Signed-off-by: Keith Packard + +commit 536e53c2e17b37df8c65d2f6921a5d68791a7789 +Author: Keith Packard +Date: Fri Oct 8 18:31:35 2021 -0700 + + Version 1.9.9.1 + + Signed-off-by: Keith Packard + +commit 5cb393c1743a5c0f307631199abba067821db370 +Author: Keith Packard +Date: Thu Oct 7 22:45:37 2021 -0700 + + libaltos: Use original windows printf/scanf + + mingw now uses "improved" versions of printf/scanf, which may cause + trouble with some windows 10 installs. Just use the old versions. + + Signed-off-by: Keith Packard + +commit c15bb9513ab0f8636bf52ec827551134c773e832 +Author: Keith Packard +Date: Wed Oct 6 22:58:09 2021 -0700 + + libaltos: Make windows dlls reproducible + + Use SOURCE_DATE_EPOCH=0 to ensure these dlls are + reproducible. + + Signed-off-by: Keith Packard + +commit bd71c839b542c417a90ab59db97e0969f7e27731 +Author: Bdale Garbee +Date: Thu Oct 7 00:00:42 2021 -0600 + + releasing 1.9.9 + commit 2f1d5b25e72324512238920b45e864bf7c5d16fe Merge: c0fe810e 6ef22682 Author: Bdale Garbee diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java index 5caee5f8..1fcb0a47 100644 --- a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroid.java @@ -20,6 +20,7 @@ package org.altusmetrum.AltosDroid; import java.lang.ref.WeakReference; import java.util.*; +import java.io.*; import android.Manifest; import android.app.Activity; @@ -86,6 +87,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener, public static final int MSG_UPDATE_AGE = 2; public static final int MSG_IDLE_MODE = 3; public static final int MSG_IGNITER_STATUS = 4; + public static final int MSG_FILE_FAILED = 5; // Intent request codes public static final int REQUEST_CONNECT_DEVICE = 1; @@ -190,6 +192,9 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener, ad.idle_mode = (Boolean) msg.obj; ad.update_state(null); break; + case MSG_FILE_FAILED: + ad.file_failed((File) msg.obj); + break; } } }; @@ -1010,6 +1015,24 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener, } } + boolean fail_shown; + + private void file_failed(File file) { + if (!fail_shown) { + fail_shown = true; + AlertDialog fail = new AlertDialog.Builder(this).create(); + fail.setTitle("Failed to Create Log File"); + fail.setMessage(file.getPath()); + fail.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + } + }); + fail.show(); + } + } + @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java index 5d836f5d..170353ab 100644 --- a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java +++ b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/AltosDroidPreferencesBackend.java @@ -78,15 +78,18 @@ public class AltosDroidPreferencesBackend extends AltosPreferencesBackend { public String getString(String key, String def) { String ret; - ret = prefs.getString(key, def); -// AltosDebug.debug("AltosDroidPreferencesBackend get string %s:\n", key); -// if (ret == null) -// AltosDebug.debug(" (null)\n"); -// else { -// String[] lines = ret.split("\n"); -// for (String l : lines) -// AltosDebug.debug(" %s\n", l); -// } + if (key.equals(AltosPreferences.logdirPreference)) + ret = null; + else + ret = prefs.getString(key, def); + AltosDebug.debug("AltosDroidPreferencesBackend get string %s:\n", key); + if (ret == null) + AltosDebug.debug(" (null)\n"); + else { + String[] lines = ret.split("\n"); + for (String l : lines) + AltosDebug.debug(" %s\n", l); + } return ret; } @@ -135,7 +138,7 @@ public class AltosDroidPreferencesBackend extends AltosPreferencesBackend { } public File homeDirectory() { - return Environment.getExternalStorageDirectory(); + return context.getExternalMediaDirs()[0]; } public void debug(String format, Object ... arguments) { diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryLogger.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryLogger.java index 589e15d0..ae5702b4 100644 --- a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryLogger.java +++ b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryLogger.java @@ -1,5 +1,24 @@ +/* + * Copyright © 2021 Keith Packard + * + * 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 2 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ package org.altusmetrum.AltosDroid; +import java.io.*; + import org.altusmetrum.altoslib_14.*; import android.content.BroadcastReceiver; @@ -8,15 +27,24 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Environment; -public class TelemetryLogger { - private Context context = null; +public class TelemetryLogger implements AltosLogTrace { + private TelemetryService service = null; private AltosLink link = null; private AltosLog logger = null; private BroadcastReceiver mExternalStorageReceiver; - public TelemetryLogger(Context in_context, AltosLink in_link) { - context = in_context; + /* AltosLogTrace interface */ + public void trace(String format, Object ... arguments) { + AltosDebug.debug(format, arguments); + } + + public void open_failed(File file) { + service.send_file_failed_to_clients(file); + } + + public TelemetryLogger(TelemetryService in_service, AltosLink in_link) { + service = in_service; link = in_link; startWatchingExternalStorage(); @@ -40,7 +68,7 @@ public class TelemetryLogger { if (Environment.MEDIA_MOUNTED.equals(state)) { if (logger == null) { AltosDebug.debug("Starting up Telemetry Logging"); - logger = new AltosLog(link); + logger = new AltosLog(link,this); } } else { AltosDebug.debug("External Storage not present - stopping"); @@ -58,12 +86,12 @@ public class TelemetryLogger { IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_MOUNTED); filter.addAction(Intent.ACTION_MEDIA_REMOVED); - context.registerReceiver(mExternalStorageReceiver, filter); + service.registerReceiver(mExternalStorageReceiver, filter); handleExternalStorageState(); } void stopWatchingExternalStorage() { - context.unregisterReceiver(mExternalStorageReceiver); + service.unregisterReceiver(mExternalStorageReceiver); } } diff --git a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryService.java b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryService.java index 2c2095df..b0b82ab9 100644 --- a/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryService.java +++ b/altosdroid/app/src/main/java/org/altusmetrum/AltosDroid/TelemetryService.java @@ -20,6 +20,7 @@ package org.altusmetrum.AltosDroid; import java.lang.ref.WeakReference; import java.util.concurrent.TimeoutException; +import java.io.*; import java.util.*; import android.app.*; @@ -340,6 +341,21 @@ public class TelemetryService extends Service implements AltosIdleMonitorListene send_idle_mode_to_client(client); } + private void send_file_failed_to_client(Messenger client, File f) { + Message m = Message.obtain(null, AltosDroid.MSG_FILE_FAILED, f); + try { + client.send(m); + } catch (RemoteException e) { + AltosDebug.error("Client %s disappeared", client.toString()); + remove_client(client); + } + } + + public void send_file_failed_to_clients(File f) { + for (Messenger client : clients) + send_file_failed_to_client(client, f); + } + private void telemetry_start() { if (telemetry_reader == null && idle_monitor == null && !ignite_running) { telemetry_reader = new TelemetryReader(altos_link, handler); diff --git a/altoslib/AltosLog.java b/altoslib/AltosLog.java index 7065614b..7dc9fd4c 100644 --- a/altoslib/AltosLog.java +++ b/altoslib/AltosLog.java @@ -37,6 +37,12 @@ public class AltosLog implements Runnable { Thread log_thread; AltosFile file; AltosLink link; + AltosLogTrace trace; + + private void trace(String format, Object ... arguments) { + if (trace != null) + trace.trace(format, arguments); + } private void close_log_file() { if (log_file != null) { @@ -62,10 +68,25 @@ public class AltosLog implements Runnable { } boolean open (AltosCalData cal_data) throws IOException, InterruptedException { + trace("open serial %d flight %d receiver_serial %d", + cal_data.serial, + cal_data.flight, + cal_data.receiver_serial); + AltosFile a = new AltosFile(cal_data); - log_file = new FileWriter(a, true); + trace("open file %s\n", a.getPath()); + + try { + log_file = new FileWriter(a, true); + } catch (IOException ie) { + log_file = null; + trace("open file failed\n"); + if (trace != null) + trace.open_failed(a); + } if (log_file != null) { + trace("open file success\n"); while (!pending_queue.isEmpty()) { String s = pending_queue.take(); log_file.write(s); @@ -79,6 +100,7 @@ public class AltosLog implements Runnable { } public void run () { + trace("log run start\n"); try { AltosConfigData receiver_config = link.config_data(); AltosCalData cal_data = new AltosCalData(); @@ -117,21 +139,30 @@ public class AltosLog implements Runnable { pending_queue.put(line.line); } } catch (InterruptedException ie) { + trace("interrupted exception\n"); } catch (TimeoutException te) { + trace("timeout exception\n"); } catch (IOException ie) { + trace("io exception %s message %s\n", ie.toString(), ie.getMessage()); } + trace("log run done\n"); close(); } - public AltosLog (AltosLink link) { + public AltosLog (AltosLink link, AltosLogTrace trace) { pending_queue = new LinkedBlockingQueue (); input_queue = new LinkedBlockingQueue (); link.add_monitor(input_queue); serial = -1; flight = -1; + this.trace = trace; this.link = link; log_file = null; log_thread = new Thread(this); log_thread.start(); } + + public AltosLog (AltosLink link) { + this(link, null); + } } diff --git a/altoslib/AltosLogTrace.java b/altoslib/AltosLogTrace.java new file mode 100644 index 00000000..64b41d61 --- /dev/null +++ b/altoslib/AltosLogTrace.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2021 Keith Packard + * + * 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 2 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.altoslib_14; + +import java.io.*; +import java.net.*; + +public interface AltosLogTrace { + public abstract void trace(String format, Object ... arguments); + + public abstract void open_failed(File path); +} diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am index 39e287fa..21651ef9 100644 --- a/altoslib/Makefile.am +++ b/altoslib/Makefile.am @@ -87,6 +87,7 @@ altoslib_JAVA = \ AltosLink.java \ AltosListenerState.java \ AltosLog.java \ + AltosLogTrace.java \ AltosMag.java \ AltosMma655x.java \ AltosMs5607.java \ diff --git a/configure.ac b/configure.ac index 71a334b2..780db881 100644 --- a/configure.ac +++ b/configure.ac @@ -18,13 +18,13 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.9.9) -ANDROID_VERSION=31 +AC_INIT([altos], 1.9.10) +ANDROID_VERSION=32 AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -RELEASE_DATE=2021-10-06 +RELEASE_DATE=2021-10-10 AC_SUBST(RELEASE_DATE) DOC_DATE=`LC_ALL=C date -d $RELEASE_DATE +'%d %b %Y'` diff --git a/doc/Makefile.am b/doc/Makefile.am index 52c408e3..d7d92f2c 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -17,6 +17,7 @@ FAKETIME=TZ=UTC faketime -f '$(RELEASE_DATE) 00:00:00 i0' endif RELNOTES_INC=\ + release-notes-1.9.10.inc \ release-notes-1.9.9.inc \ release-notes-1.9.8.inc \ release-notes-1.9.7.inc \ diff --git a/doc/easymini-release-notes.inc b/doc/easymini-release-notes.inc index a1b4415a..34e6471a 100644 --- a/doc/easymini-release-notes.inc +++ b/doc/easymini-release-notes.inc @@ -1,5 +1,9 @@ [appendix] == Release Notes + :leveloffset: 2 + include::release-notes-1.9.10.adoc[] + + <<<< :leveloffset: 2 include::release-notes-1.9.9.adoc[] diff --git a/doc/release-notes-1.9.10.inc b/doc/release-notes-1.9.10.inc new file mode 100644 index 00000000..a3e07865 --- /dev/null +++ b/doc/release-notes-1.9.10.inc @@ -0,0 +1,21 @@ += Release Notes for Version 1.9.10 +include::release-head.adoc[] +:doctype: article + + Version 1.9.9 + + This release contains a couple of bug fixes for ground station software. + + == AltosUI + + * Rework the windows DLL build to make AltosUI run on more + instances of Windows 10. + + == AltosDroid + + * Adapt to Android security changes which prevent AltosDroid + from storing flights in + /storage/emulated/0/AltusMetrum. Now, flights are stored in + /storage/emulated/0/media/org.altusmetrum.AltosDroid/AltusMetrum + instead. Also, AltosDroid will display an error message if + flight data cannot be logged. diff --git a/doc/release-notes.inc b/doc/release-notes.inc index 4a76c96f..f492981a 100644 --- a/doc/release-notes.inc +++ b/doc/release-notes.inc @@ -1,5 +1,9 @@ [appendix] == Release Notes + :leveloffset: 2 + include::release-notes-1.9.10.adoc[] + + <<<< :leveloffset: 2 include::release-notes-1.9.9.adoc[] diff --git a/doc/telegps-release-notes.inc b/doc/telegps-release-notes.inc index 90f2e27e..dedc6d4a 100644 --- a/doc/telegps-release-notes.inc +++ b/doc/telegps-release-notes.inc @@ -1,5 +1,9 @@ [appendix] == Release Notes + :leveloffset: 2 + include::release-notes-1.9.10.adoc[] + + <<<< :leveloffset: 2 include::release-notes-1.9.9.adoc[] diff --git a/libaltos/Makefile.am b/libaltos/Makefile.am index 2b9a7aa6..98fa8c11 100644 --- a/libaltos/Makefile.am +++ b/libaltos/Makefile.am @@ -122,10 +122,10 @@ MINGLIBS=-lsetupapi -lws2_32 fat: all altos.dll altos64.dll altos.dll: $(WINDOWS_SRC) $(WINDOWS_H) - $(MINGCC32) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS) + SOURCE_DATE_EPOCH=0 $(MINGCC32) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS) altos64.dll: $(WINDOWS_SRC) $(WINDOWS_H) - $(MINGCC64) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS) + SOURCE_DATE_EPOCH=0 $(MINGCC64) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS) clean-local: -rm -rf libaltosJNI *.class *.java classlibaltos.stamp $(SWIG_FILE) libaltos_wrap.c altos.dll altos64.dll diff --git a/libaltos/libaltos_windows.c b/libaltos/libaltos_windows.c index 33eb77c7..f91859ac 100644 --- a/libaltos/libaltos_windows.c +++ b/libaltos/libaltos_windows.c @@ -59,12 +59,12 @@ log_message(char *fmt, ...) char buffer[4096]; GetLocalTime(&time); - sprintf (buffer, "%4d-%02d-%02d %2d:%02d:%02d. ", + __ms_sprintf (buffer, "%4d-%02d-%02d %2d:%02d:%02d. ", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond); va_start(a, fmt); - vsprintf(buffer + strlen(buffer), fmt, a); + __ms_vsprintf(buffer + strlen(buffer), fmt, a); va_end(a); fputs(buffer, log); @@ -188,11 +188,11 @@ altos_list_next(struct altos_list *list, struct altos_device *device) if (result != 0) { altos_set_last_windows_error(); } else { - sscanf((char *) symbolic + sizeof("\\??\\USB#VID_") - 1, + __ms_sscanf((char *) symbolic + sizeof("\\??\\USB#VID_") - 1, "%04X", &vid); - sscanf((char *) symbolic + sizeof("\\??\\USB#VID_XXXX&PID_") - 1, + __ms_sscanf((char *) symbolic + sizeof("\\??\\USB#VID_XXXX&PID_") - 1, "%04X", &pid); - sscanf((char *) symbolic + sizeof("\\??\\USB#VID_XXXX&PID_XXXX#") - 1, + __ms_sscanf((char *) symbolic + sizeof("\\??\\USB#VID_XXXX&PID_XXXX#") - 1, "%d", &serial); } if (vid == 0 || pid == 0 || serial == 0) { @@ -201,11 +201,11 @@ altos_list_next(struct altos_list *list, struct altos_device *device) instanceid, sizeof (instanceid), &instanceid_len)) { - sscanf((char *) instanceid + sizeof("USB\\VID_") - 1, + __ms_sscanf((char *) instanceid + sizeof("USB\\VID_") - 1, "%04X", &vid); - sscanf((char *) instanceid + sizeof("USB\\VID_XXXX&PID_") - 1, + __ms_sscanf((char *) instanceid + sizeof("USB\\VID_XXXX&PID_") - 1, "%04X", &pid); - sscanf((char *) instanceid + sizeof("USB\\VID_XXXX&PID_XXXX\\") - 1, + __ms_sscanf((char *) instanceid + sizeof("USB\\VID_XXXX&PID_XXXX\\") - 1, "%d", &serial); } else { altos_set_last_windows_error(); @@ -667,7 +667,7 @@ static void ba2str(BTH_ADDR ba, char *str) { - sprintf(str, "%02X:%02X:%02X:%02X:%02X:%02X", + __ms_sprintf(str, "%02X:%02X:%02X:%02X:%02X:%02X", get_byte(ba, 0), get_byte(ba, 1), get_byte(ba, 2), @@ -681,7 +681,7 @@ str2ba(char *str) { unsigned int bytes[6]; - sscanf(str, "%02x:%02x:%02x:%02x:%02x:%02x", + __ms_sscanf(str, "%02x:%02x:%02x:%02x:%02x:%02x", &bytes[0], &bytes[1], &bytes[2], diff --git a/src/telemega-v5.0/.gitignore b/src/telemega-v5.0/.gitignore new file mode 100644 index 00000000..e67759a2 --- /dev/null +++ b/src/telemega-v5.0/.gitignore @@ -0,0 +1,2 @@ +ao_product.h +telemega-*.elf