Skip to content

Commit b882e1f

Browse files
committed
Fix issues after rebase
1 parent 00ee3cb commit b882e1f

File tree

3 files changed

+18
-43
lines changed

3 files changed

+18
-43
lines changed

libmk/libmk.c

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,6 @@ const unsigned char LIBMK_LAYOUT[2][3][LIBMK_MAX_ROWS][LIBMK_MAX_COLS] = {
178178
};
179179

180180

181-
const char* LIBMK_MODEL_STRINGS[] = {
182-
"MasterKeys Pro L RGB", // 0
183-
"MasterKeys Pro S RGB", // 1
184-
"MasterKeys Pro L White", // 2
185-
"MasterKeys Pro M White", // 3
186-
"Unknown Model", // 4
187-
"MasterKeys Pro M RGB", // 5
188-
"Unknown Model", // 6
189-
"MasterKeys Pro S White",
190-
};
191-
192-
193181
bool libmk_init(void) {
194182
int result = libusb_init(&Context);
195183
#ifdef LIBMK_USB_DEBUG
@@ -472,9 +460,9 @@ int libmk_enable_control(LibMK_Handle* handle) {
472460

473461

474462
int libmk_send_control_packet(LibMK_Handle* handle) {
475-
r = libmk_set_control_mode(handle, LIBMK_CUSTOM_CTRL);
463+
int r = libmk_set_control_mode(handle, LIBMK_CUSTOM_CTRL);
476464
if (r != LIBMK_SUCCESS)
477-
return LIBMK_ERR_SEND;
465+
return r;
478466
LibMK_Firmware* fw;
479467
r = libmk_get_firmware_version(handle, &fw);
480468
if (r != LIBMK_SUCCESS) {
@@ -565,40 +553,16 @@ int libmk_set_full_color(LibMK_Handle* handle,
565553

566554

567555
int libmk_send_packet(LibMK_Handle* handle, unsigned char* packet) {
568-
<<<<<<< HEAD
569-
=======
570-
/** Send a single packet of data to the specified device
571-
*
572-
* Calls libmk_send_recv_packet but instructs it not to care about
573-
* receiving a response.
574-
*/
575556
return libmk_send_recv_packet(handle, packet, true);
576557
}
577558

578559

579560
int libmk_send_recv_packet(
580561
LibMK_Handle* handle, unsigned char* packet, bool response_required) {
581-
/** Send a single packet of data to the specified device
582-
*
583-
* The device operates in INTERRUPT mode, expects 64 bytes of data
584-
* every time. First sends the packet to the device OUT endpoint,
585-
* then reads a packet from the device IN endpoint. If the packet
586-
* was correctly formatted, this received packet has the same header
587-
* as the packet sent. If the header is HEADER_ERROR, then a
588-
* protocol error has occurred and the packet was rejected.
589-
*
590-
* response_required: Boolean argument that determines whether an
591-
* acknowledgement packet is required from the keyboard. Nearly
592-
* all operations yield a confirmation packet, but some do not. If
593-
* it is not required, the function will still attempt to retrieve
594-
* a response, but not care if it is not available.
595-
*/
596562
if (handle == NULL)
597563
handle = DeviceHandle;
598564
if (handle == NULL)
599565
return LIBMK_ERR_DEV_NOT_SET;
600-
601-
>>>>>>> 748c903... Fix errors during profile control
602566
int t, result;
603567
int r = libusb_interrupt_transfer(
604568
handle->handle, LIBMK_EP_OUT | LIBUSB_ENDPOINT_OUT,

libmk/libmk.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typedef enum LibMK_Result {
5050
LIBMK_ERR_TRANSFER = -10, ///< Failed to transfer data to or from device
5151
LIBMK_ERR_DESCR = -11, ///< Failed to get libusb device descriptor
5252
LIBMK_ERR_PROTOCOL = -13, ///< Keyboard interaction protocol error
53-
LIBMK_ERR_INV_ARGS = -14, ///< Invalid arguments passed by caller
53+
LIBMK_ERR_INVALID_ARG = -14, ///< Invalid arguments passed by caller
5454
} LibMK_Result;
5555

5656

@@ -127,7 +127,6 @@ typedef enum LibMK_Model {
127127
} LibMK_Model;
128128

129129

130-
<<<<<<< HEAD
131130
/** @brief Struct describing a supported USB device
132131
*
133132
* This struct may be used as a linked list. Holds information required

masterkeys/__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ def detect_devices():
103103
"""
104104
Detect supported connected devices and return a tuple of models
105105
106-
:return: tuple[int] identifying models
107-
:raises: RuntimeError upon internal Python error
106+
:return: Tuple of integers (:class:``.Model``)
107+
:rtype: Tuple[int, ...]
108+
:raises: ``RuntimeError`` upon internal Python error
108109
"""
109110
return _mk.detect_devices()
110111

@@ -221,6 +222,7 @@ def get_device_ident():
221222
# type: () -> int
222223
"""
223224
Return the bDevice USB descriptor value for the controlled keyboard
225+
224226
:return: bDevice USB descriptor value or result code (<0)
225227
:rtype: int
226228
"""
@@ -234,6 +236,11 @@ def set_all_led_color_dict(keys):
234236
235237
The keys should be specified in a dictionary of the format
236238
{(row, col): (r, g, b)}
239+
240+
:param keys: Dictionary containing key color data
241+
:type keys: Dict[Tuple[int, int], Tuple[int, int, int]]
242+
:return: Result code (:class:``.ResultCode``)
243+
:rtype: int
237244
"""
238245
layout = build_layout_list()
239246
for (row, col), (r, g, b) in keys.items():
@@ -243,7 +250,12 @@ def set_all_led_color_dict(keys):
243250

244251
def build_layout_list():
245252
# type: () -> List[List[Tuple[int, int, int], ...], ...]
246-
"""Return a list of the right proportions for full LED layout"""
253+
"""
254+
Return a list of the right proportions for full LED layout
255+
256+
:return: Empty layout list
257+
:rtype: List[List[Tuple[int, int, int], ...], ...]
258+
"""
247259
layout = list()
248260
for i in range(MAX_ROWS):
249261
column = list()

0 commit comments

Comments
 (0)