@@ -28,8 +28,6 @@ local THIRD_REALITY_MANUFACTURER_ID = 0x1407
28
28
local THIRD_REALITY_MK1_PRODUCT_ID = 0x1388
29
29
30
30
local function is_third_reality_mk1 (opts , driver , device )
31
- if not device .manufacturer_info then return false end
32
- -- this sub driver does not support child devices
33
31
if device .network_type == device_lib .NETWORK_TYPE_MATTER and
34
32
device .manufacturer_info .vendor_id == THIRD_REALITY_MANUFACTURER_ID and
35
33
device .manufacturer_info .product_id == THIRD_REALITY_MK1_PRODUCT_ID then
@@ -104,12 +102,24 @@ local function info_changed(driver, device, event, args)
104
102
end
105
103
end
106
104
107
- local function do_configure (driver , device )
105
+ local function match_profile (driver , device )
108
106
device :try_update_metadata ({profile = " 12-button-keyboard" })
109
107
build_button_component_map (device )
110
108
configure_buttons (device )
111
109
end
112
110
111
+ local function do_configure (driver , device )
112
+ if device .network_type == device_lib .NETWORK_TYPE_MATTER then
113
+ match_profile (driver , device )
114
+ end
115
+ end
116
+
117
+ local function driver_switched (driver , device )
118
+ if device .network_type == device_lib .NETWORK_TYPE_MATTER then
119
+ match_profile (driver , device )
120
+ end
121
+ end
122
+
113
123
local function initial_press_event_handler (driver , device , ib , response )
114
124
device :emit_event_for_endpoint (ib .endpoint_id , capabilities .button .button .pushed ({state_change = true }))
115
125
end
@@ -120,7 +130,8 @@ local third_reality_mk1_handler = {
120
130
init = device_init ,
121
131
added = device_added ,
122
132
infoChanged = info_changed ,
123
- doConfigure = do_configure
133
+ doConfigure = do_configure ,
134
+ driverSwitched = driver_switched
124
135
},
125
136
matter_handlers = {
126
137
event = {
0 commit comments