11// SPDX-License-Identifier: MIT
2- // Copyright (c) 2020-2025 The Pybricks Authors
2+ // Copyright (c) 2020-2026 The Pybricks Authors
33
44import { Reducer , combineReducers } from 'redux' ;
55import * as semver from 'semver' ;
@@ -31,6 +31,7 @@ import {
3131 usbDidDisconnectPybricks ,
3232 usbDidReceiveDeviceName ,
3333 usbDidReceiveFirmwareRevision ,
34+ usbDidReceiveSoftwareRevision ,
3435 usbDisconnectPybricks ,
3536} from '../usb/actions' ;
3637import { pythonVersionToSemver } from '../utils/version' ;
@@ -361,7 +362,10 @@ const useLegacyDownload: Reducer<boolean> = (state = false, action) => {
361362 * When true, use NUS for stdio instead of Pybricks control characteristic.
362363 */
363364const useLegacyStdio : Reducer < boolean > = ( state = false , action ) => {
364- if ( bleDIServiceDidReceiveSoftwareRevision . matches ( action ) ) {
365+ if (
366+ bleDIServiceDidReceiveSoftwareRevision . matches ( action ) ||
367+ usbDidReceiveSoftwareRevision . matches ( action )
368+ ) {
365369 // Behavior changed starting with Pybricks Profile v1.3.0.
366370 return ! semver . satisfies ( action . version , '^1.3.0' ) ;
367371 }
@@ -373,7 +377,10 @@ const useLegacyStdio: Reducer<boolean> = (state = false, action) => {
373377 * When true, use Legacy StartUserProgram.
374378 */
375379const useLegacyStartUserProgram : Reducer < boolean > = ( state = false , action ) => {
376- if ( bleDIServiceDidReceiveSoftwareRevision . matches ( action ) ) {
380+ if (
381+ bleDIServiceDidReceiveSoftwareRevision . matches ( action ) ||
382+ usbDidReceiveSoftwareRevision . matches ( action )
383+ ) {
377384 // Behavior changed starting with Pybricks Profile v1.4.0.
378385 return ! semver . satisfies ( action . version , '^1.4.0' ) ;
379386 }
@@ -385,7 +392,10 @@ const useLegacyStartUserProgram: Reducer<boolean> = (state = false, action) => {
385392 * When true, use the legacy `__main__` module name instead of the actual file name.
386393 */
387394const useLegacyMainModule : Reducer < boolean > = ( state = false , action ) => {
388- if ( bleDIServiceDidReceiveSoftwareRevision . matches ( action ) ) {
395+ if (
396+ bleDIServiceDidReceiveSoftwareRevision . matches ( action ) ||
397+ usbDidReceiveSoftwareRevision . matches ( action )
398+ ) {
389399 // Behavior changed starting with Pybricks Profile v1.5.0.
390400 return ! semver . satisfies ( action . version , '^1.5.0' ) ;
391401 }
0 commit comments