warn user if example keyboard UID is used

main
Ilya Zhuravlev 2021-03-27 05:51:29 -04:00
parent 41ab825d8e
commit e5fddeb475
2 changed files with 14 additions and 1 deletions

View File

@ -14,7 +14,7 @@ from keymaps import KEYMAPS
from layout_editor import LayoutEditor from layout_editor import LayoutEditor
from macro_recorder import MacroRecorder from macro_recorder import MacroRecorder
from unlocker import Unlocker from unlocker import Unlocker
from util import tr, find_vial_devices from util import tr, find_vial_devices, EXAMPLE_KEYBOARDS
from vial_device import VialKeyboard from vial_device import VialKeyboard
import themes import themes
@ -216,6 +216,11 @@ class MainWindow(QMainWindow):
else: else:
self.current_device.open(None) self.current_device.open(None)
if isinstance(self.current_device, VialKeyboard) \
and self.current_device.keyboard.keyboard_id in EXAMPLE_KEYBOARDS:
QMessageBox.warning(self, "", "An example keyboard UID was detected.\n"
"Please change your keyboard UID to be unique before you ship!")
self.rebuild() self.rebuild()
self.refresh_tabs() self.refresh_tabs()

View File

@ -19,6 +19,14 @@ VIBL_SERIAL_NUMBER_MAGIC = "vibl:d4f8159c"
MSG_LEN = 32 MSG_LEN = 32
# these should match what we have in vial-qmk/keyboards/vial_example
# so that people don't accidentally reuse a sample keyboard UID
EXAMPLE_KEYBOARDS = [
0xD4A36200603E3007, # vial_stm32f103_vibl
0x32F62BC2EEF2237B, # vial_atmega32u4
0x38CEA320F23046A5, # vial_stm32f072
]
def hid_send(dev, msg, retries=1): def hid_send(dev, msg, retries=1):
if len(msg) > MSG_LEN: if len(msg) > MSG_LEN: