Skip to content

Commit aa35d29

Browse files
committed
fix: update USB device configuration selection logic
1 parent d4939cb commit aa35d29

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/usb/sagas.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,9 @@ function* handleUsbConnectPybricks(hotPlugDevice?: USBDevice): Generator {
165165
// configuration and it is already selected and that it contains a Pybricks
166166
// interface.
167167

168-
if (!usbDevice.configuration && usbDevice.configurations.length > 0) {
168+
if (usbDevice.configuration === null) {
169169
const [, selectErr] = yield* call(() =>
170-
maybe(
171-
usbDevice.selectConfiguration(
172-
usbDevice.configurations[0].configurationValue,
173-
),
174-
),
170+
maybe(usbDevice.selectConfiguration(1)),
175171
);
176172

177173
// TODO: show error message to user here
@@ -183,7 +179,6 @@ function* handleUsbConnectPybricks(hotPlugDevice?: USBDevice): Generator {
183179
}
184180
}
185181

186-
assert(!!usbDevice.configuration, 'USB device configuration is undefined');
187182
assert(
188183
usbDevice.configuration.interfaces.length > 0,
189184
'USB device has no interfaces',

0 commit comments

Comments
 (0)