Skip to content

Commit 375213b

Browse files
committed
Add rescan function
1 parent 605b5f3 commit 375213b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

openrgb/network.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ def requestPluginList(self):
227227
self.send_header(0, utils.PacketType.REQUEST_PLUGIN_LIST, 0)
228228
self.read()
229229

230+
def requestRescanDevices(self):
231+
'''
232+
Sends the request to rescan devices
233+
'''
234+
self.send_header(0, utils.PacketType.REQUEST_RESCAN_DEVICES, 0)
235+
230236
def send_header(self, device_id: int, packet_type: utils.PacketType, packet_size: int, release_lock: bool = True):
231237
'''
232238
Sends a header to the SDK

openrgb/orgb.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ def disconnect(self):
621621
'''Disconnects from the OpenRGB SDK'''
622622
self.comms.stop_connection()
623623

624+
def rescan(self):
625+
'''Rescans for devices'''
626+
self.comms.requestRescanDevices()
627+
624628
@property
625629
def protocol_version(self):
626630
'''The protocol version of the connected SDK server'''

openrgb/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class PacketType(IntEnum):
7474
REQUEST_PROTOCOL_VERSION = 40
7575
SET_CLIENT_NAME = 50
7676
DEVICE_LIST_UPDATED = 100
77+
REQUEST_RESCAN_DEVICES = 140
7778
REQUEST_PROFILE_LIST = 150
7879
REQUEST_SAVE_PROFILE = 151
7980
REQUEST_LOAD_PROFILE = 152

0 commit comments

Comments
 (0)