summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/python/qmk/cli/generate/config_h.py3
-rw-r--r--lib/python/qmk/info.py8
-rw-r--r--lib/python/qmk/keymap.py2
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py4
-rw-r--r--lib/usbhost/USB_Host_Shield_2.0/SPP.cpp2
-rw-r--r--lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino2
-rw-r--r--lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino2
-rw-r--r--lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h2
-rw-r--r--lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h2
9 files changed, 11 insertions, 16 deletions
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index a26dcdf7d7..a2178bf1e9 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -117,9 +117,10 @@ def generate_config_items(kb_info_json, config_h_lines):
config_h_lines.append(f'# define {key} {value}')
config_h_lines.append(f'#endif // {key}')
elif key_type == 'str':
+ escaped_str = config_value.replace('\\', '\\\\').replace('"', '\\"')
config_h_lines.append('')
config_h_lines.append(f'#ifndef {config_key}')
- config_h_lines.append(f'# define {config_key} "{config_value}"')
+ config_h_lines.append(f'# define {config_key} "{escaped_str}"')
config_h_lines.append(f'#endif // {config_key}')
elif key_type == 'bcd_version':
(major, minor, revision) = config_value.split('.')
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index c95b55916c..637a27b764 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -479,7 +479,7 @@ def _config_to_json(key_type, config_value):
return int(config_value)
elif key_type == 'str':
- return config_value.strip('"')
+ return config_value.strip('"').replace('\\"', '"').replace('\\\\', '\\')
elif key_type == 'bcd_version':
major = int(config_value[2:4])
@@ -755,9 +755,6 @@ def arm_processor_rules(info_data, rules):
info_data['processor_type'] = 'arm'
info_data['protocol'] = 'ChibiOS'
- if 'bootloader' not in info_data:
- info_data['bootloader'] = 'unknown'
-
if 'STM32' in info_data['processor']:
info_data['platform'] = 'STM32'
elif 'MCU_SERIES' in rules:
@@ -775,9 +772,6 @@ def avr_processor_rules(info_data, rules):
info_data['platform'] = rules['ARCH'] if 'ARCH' in rules else 'unknown'
info_data['protocol'] = 'V-USB' if rules.get('MCU') in VUSB_PROCESSORS else 'LUFA'
- if 'bootloader' not in info_data:
- info_data['bootloader'] = 'atmel-dfu'
-
# FIXME(fauxpark/anyone): Eventually we should detect the protocol by looking at PROTOCOL inherited from mcu_selection.mk:
# info_data['protocol'] = 'V-USB' if rules.get('PROTOCOL') == 'VUSB' else 'LUFA'
diff --git a/lib/python/qmk/keymap.py b/lib/python/qmk/keymap.py
index f317f4d11e..fc1421962f 100644
--- a/lib/python/qmk/keymap.py
+++ b/lib/python/qmk/keymap.py
@@ -412,7 +412,7 @@ def list_keymaps(keyboard, c=True, json=True, additional_files=None, fullpath=Fa
rules = rules_mk(keyboard)
names = set()
- if rules:
+ if rules is not None:
keyboards_dir = Path('keyboards')
kb_path = keyboards_dir / keyboard
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index fde8b079a3..185abb5f21 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -265,8 +265,8 @@ def test_generate_config_h():
check_returncode(result)
assert '# define DEVICE_VER 0x0001' in result.stdout
assert '# define DIODE_DIRECTION COL2ROW' in result.stdout
- assert '# define MANUFACTURER none' in result.stdout
- assert '# define PRODUCT pytest' in result.stdout
+ assert '# define MANUFACTURER "none"' in result.stdout
+ assert '# define PRODUCT "pytest"' in result.stdout
assert '# define PRODUCT_ID 0x6465' in result.stdout
assert '# define VENDOR_ID 0xFEED' in result.stdout
assert '# define MATRIX_COLS 1' in result.stdout
diff --git a/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp b/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp
index 0f4ee5e981..8169707661 100644
--- a/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp
+++ b/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp
@@ -757,7 +757,7 @@ size_t SPP::write(const uint8_t *data, size_t size) {
void SPP::write(const uint8_t *data, size_t size) {
#endif
for(uint8_t i = 0; i < size; i++) {
- if(sppIndex >= sizeof (sppOutputBuffer) / sizeof (sppOutputBuffer[0]))
+ if(sppIndex >= ARRAY_SIZE(sppOutputBuffer))
send(); // Send the current data in the buffer
sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function
}
diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino
index 5ebfd7819c..11833334d0 100644
--- a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino
+++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino
@@ -19,7 +19,7 @@ USB Usb;
BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
PS3BT *PS3[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM!
-const uint8_t length = sizeof(PS3) / sizeof(PS3[0]); // Get the lenght of the array
+const uint8_t length = ARRAY_SIZE(PS3); // Get the lenght of the array
bool printAngle[length];
bool oldControllerState[length];
diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino
index 07c6f13d2b..93cd084651 100644
--- a/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino
+++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino
@@ -19,7 +19,7 @@ USB Usb;
BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
WII *Wii[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM!
-const uint8_t length = sizeof(Wii) / sizeof(Wii[0]); // Get the lenght of the array
+const uint8_t length = ARRAY_SIZE(Wii); // Get the lenght of the array
bool printAngle[length];
bool oldControllerState[length];
diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
index 2400364e65..05dab14afe 100644
--- a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
+++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h
@@ -25,7 +25,7 @@ public:
virtual void OnGamePadChanged(const GamePadEventData *evt);
};
-#define RPT_GAMEPAD_LEN sizeof(GamePadEventData)/sizeof(uint8_t)
+#define RPT_GAMEPAD_LEN sizeof(GamePadEventData)
class JoystickReportParser : public HIDReportParser
{
diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h
index 57fbb033bf..7af18b88f7 100644
--- a/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h
+++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h
@@ -38,7 +38,7 @@ public:
virtual void OnScaleChanged(const ScaleEventData *evt);
};
-#define RPT_SCALE_LEN sizeof(ScaleEventData)/sizeof(uint8_t)
+#define RPT_SCALE_LEN sizeof(ScaleEventData)
class ScaleReportParser : public HIDReportParser
{