Compare commits

..

3 Commits

Author SHA1 Message Date
Rick Lan 1a6311b4d0 fix hash 2020-11-10 16:43:56 +10:00
Rick Lan 6cdbc95757 update ota/recovery url 2020-11-10 12:38:00 +10:00
Rick Lan 51bc8646fa update sentry 2020-09-23 15:10:16 +10:00
2 changed files with 41 additions and 20 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-e5cb30d3c0c8f7903fa2d04047296605a0136324201c30f59013c614a9fc6804.zip",
"ota_hash": "e5cb30d3c0c8f7903fa2d04047296605a0136324201c30f59013c614a9fc6804",
"recovery_url": "http://dpp.cool/neosupdate/recovery-b905c42c54fbd69b6ad6152b434b3567f24169f31ad8409aee8858ceb2918bba.img",
"recovery_len": 15926572,
"recovery_hash": "b905c42c54fbd69b6ad6152b434b3567f24169f31ad8409aee8858ceb2918bba"
}
+36 -15
View File
@@ -3,20 +3,26 @@ import os
import sys
import threading
import capnp
from common.params import Params
from datetime import datetime
import traceback
from selfdrive.version import version, dirty, origin, branch
uniqueID = Params().get('DongleId', None)
from common.params import Params
import requests
CRASHES_DIR = '/sdcard/crash_logs/'
from selfdrive.swaglog import cloudlog
from common.android import ANDROID
if os.getenv("NOLOG") or os.getenv("NOCRASH") or not ANDROID:
def capture_exception(*exc_info):
def capture_exception(*args, **kwargs):
pass
def bind_user(**kwargs):
pass
def bind_extra(**kwargs):
pass
def install():
pass
else:
@@ -27,46 +33,61 @@ 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()
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():
# installs a sys.excepthook
__excepthook__ = sys.excepthook
def handle_exception(*exc_info):
if exc_info[0] not in (KeyboardInterrupt, SystemExit):
capture_exception(exc_info=exc_info)
__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
"""
# installs a sys.excepthook
__excepthook__ = sys.excepthook
def handle_exception(*exc_info):
if exc_info[0] not in (KeyboardInterrupt, SystemExit):
capture_exception()
__excepthook__(*exc_info)
sys.excepthook = handle_exception
init_original = threading.Thread.__init__
def init(self, *args, **kwargs):