Compare commits

...

3 Commits

Author SHA1 Message Date
Rick Lan 9f4c668064 fix hash 2020-11-10 16:40:01 +10:00
Rick Lan 0dad5cfc7e update ota/recovery url 2020-11-10 12:38:46 +10:00
Rick Lan 037bc6b1f2 update sentry 2020-09-23 15:04:21 +10:00
2 changed files with 34 additions and 16 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
{
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-efdf7de63b1aef63d68301e6175930991bf9a5927d16ec6fcc69287e2ee7ca4a.zip",
"ota_hash": "efdf7de63b1aef63d68301e6175930991bf9a5927d16ec6fcc69287e2ee7ca4a",
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e.img",
"recovery_len": 15861036,
"recovery_hash": "97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e"
"ota_url": "http://dpp.cool/neosupdate/ota-signed-9718ecea1c6728a59d133605f79e90934727f5b4915aab75ee0b5a52c3007565.zip",
"ota_hash": "9718ecea1c6728a59d133605f79e90934727f5b4915aab75ee0b5a52c3007565",
"recovery_url": "http://dpp.cool/neosupdate/recovery-4772f9348e04b560b9df87d6dea6c740fa8d62ea41a8db3842eec216f04e3110.img",
"recovery_len": 15922476,
"recovery_hash": "4772f9348e04b560b9df87d6dea6c740fa8d62ea41a8db3842eec216f04e3110"
}
+29 -11
View File
@@ -3,9 +3,13 @@ import os
import sys
import threading
import capnp
from datetime import datetime
import traceback
from selfdrive.version import version, dirty, origin, branch
from common.params import Params
uniqueID = Params().get('DongleId', None)
import requests
from common.dp_common import is_online
CRASHES_DIR = '/sdcard/crash_logs/'
from selfdrive.swaglog import cloudlog
from common.android import ANDROID
@@ -30,32 +34,52 @@ else:
dongle_id = params.get("DongleId").decode('utf8')
except AttributeError:
dongle_id = "None"
error_tags = {'dirty': dirty, 'username': uniqueID, 'dongle_id': dongle_id, 'branch': branch, 'remote': origin}
try:
ip = requests.get('https://checkip.amazonaws.com/', timeout=3).text.strip() if is_online() else '255.255.255.255'
except:
ip = "255.255.255.255"
error_tags = {'dirty': dirty, 'username': dongle_id, 'dongle_id': dongle_id, 'branch': branch, 'remote': origin}
client = Client('https://980a0cba712a4c3593c33c78a12446e1:fecab286bcaf4dba8b04f7cff0188e2d@sentry.io/1488600',
client = Client('http://7107f046f45b4b4f9b277d0684bc9281@sentry.dragonpilot.cn:9000/2',
install_sys_hook=False, transport=HTTPTransport, release=version, tags=error_tags)
def capture_exception(*args, **kwargs):
save_exception(traceback.format_exc())
exc_info = sys.exc_info()
if not exc_info[0] is capnp.lib.capnp.KjException:
client.captureException(*args, **kwargs)
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
# dp - from @ShaneSmiskol, save log into local directory
def save_exception(exc_text):
if not os.path.exists(CRASHES_DIR):
os.mkdir(CRASHES_DIR)
log_file = '{}/{}'.format(CRASHES_DIR, datetime.now().strftime('%Y-%m-%d--%H-%M-%S.%f.log')[:-3])
with open(log_file, 'w') as f:
f.write(exc_text)
print('Logged current crash to {}'.format(log_file))
def bind_user(**kwargs):
client.user_context(kwargs)
def capture_warning(warning_string):
bind_user(id=dongle_id)
bind_user(id=dongle_id, ip_address=ip)
client.captureMessage(warning_string, level='warning')
def capture_info(info_string):
bind_user(id=dongle_id)
bind_user(id=dongle_id, ip_address=ip)
client.captureMessage(info_string, level='info')
def bind_extra(**kwargs):
client.extra_context(kwargs)
def install():
"""
Workaround for `sys.excepthook` thread bug from:
http://bugs.python.org/issue1230540
Call once from the main thread before creating any threads.
Source: https://stackoverflow.com/a/31622038
"""
# installs a sys.excepthook
__excepthook__ = sys.excepthook
@@ -65,12 +89,6 @@ else:
__excepthook__(*exc_info)
sys.excepthook = handle_exception
"""
Workaround for `sys.excepthook` thread bug from:
http://bugs.python.org/issue1230540
Call once from the main thread before creating any threads.
Source: https://stackoverflow.com/a/31622038
"""
init_original = threading.Thread.__init__
def init(self, *args, **kwargs):