Skip to content

Commit

Permalink
Fix value unpacking issue in get_led_luid_for_key_name and get_device…
Browse files Browse the repository at this point in the history
…_property_info
  • Loading branch information
intrueder committed Feb 14, 2023
1 parent 5544381 commit 4b12c5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cuesdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_device_property_info(self,

res = None
if err == CorsairError.CE_Success:
res = {'data_type': CorsairDataType(dt.value), 'flags': flags}
res = {'data_type': CorsairDataType(dt.value), 'flags': flags.value}

return (res, err)

Expand Down Expand Up @@ -245,16 +245,18 @@ def set_layer_priority(self, priority: int) -> CorsairError:

def get_led_luid_for_key_name(self, device_id: str, key_name: str):
if not device_id or not isinstance(key_name, str):
return (0, CorsairError(CorsairError.CE_InvalidArguments))
return (None, CorsairError(CorsairError.CE_InvalidArguments))

encoded = key_name.encode()
if len(encoded) != 1 or not ord('A') <= encoded[0] <= ord('Z'):
return (0, CorsairError(CorsairError.CE_InvalidArguments))
return (None, CorsairError(CorsairError.CE_InvalidArguments))
luid = c_uint32()
err = CorsairError(
napi.CorsairGetLedLuidForKeyName(to_native_id(device_id), encoded,
byref(luid)))
return (int(luid), err)
if (err == CorsairError.CE_Success):
return (int(luid.value), err)
return (None, err)

def set_led_colors(
self, device_id: str,
Expand Down

0 comments on commit 4b12c5b

Please sign in to comment.