Skip to content

Commit

Permalink
receiver: Pass hidpp10 instance to remove tight coupling
Browse files Browse the repository at this point in the history
Introduce Protocol and pass instance of Hidpp10 at instantiation of a
Receiver. This simplifies testing and helps to decouple device from
hidpp10.

Related #2350
  • Loading branch information
MattHag committed Mar 3, 2024
1 parent da1fb9c commit e1f2da3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/logitech_receiver/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

logger = logging.getLogger(__name__)

hidpp_instance = hidpp10.Hidpp10()
_R = hidpp10_constants.REGISTERS
_IR = hidpp10_constants.INFO_SUBREGISTERS

Expand Down Expand Up @@ -59,6 +58,7 @@ def create_receiver(device_info, setting_callback=None):

handle = _base.open_path(device_info.path)
if handle:
hidpp_instance = hidpp10.Hidpp10()
receiver_kind = product_info.get("receiver_kind", "unknown")
if receiver_kind == "bolt":
return BoltReceiver(
Expand Down

0 comments on commit e1f2da3

Please sign in to comment.