2929import android .widget .TextView ;
3030import android .widget .Toast ;
3131
32+ import androidx .annotation .IntRange ;
3233import androidx .annotation .NonNull ;
3334import androidx .appcompat .widget .PopupMenu ;
3435import androidx .core .app .ActivityCompat ;
@@ -1479,6 +1480,14 @@ private void startDFUFlash() {
14791480 .setKeepBond (true )
14801481 .setForeground (true )
14811482 .setZip ( getCachePathAppZip ());
1483+
1484+ //if ( Build.HARDWARE.equals("ums512_1h10")) {
1485+ if ( Build .MANUFACTURER .toLowerCase ().contains ("lenovo" )
1486+ && Build .DEVICE .toLowerCase ().contains ("tb328" )) {
1487+ // Lenovo M10 TB328FU with Android 12 returns mtu 247, but DFU fails
1488+ starter .disableMtuRequest (); //faster than setMtu(23), which also works
1489+ }
1490+
14821491 final DfuServiceController controller = starter .start (this , DfuService .class );
14831492 } else {
14841493 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
@@ -1490,6 +1499,12 @@ private void startDFUFlash() {
14901499 .setForceDfu (true )
14911500 .setPacketsReceiptNotificationsEnabled (true )
14921501 .setBinOrHex (DfuBaseService .TYPE_APPLICATION , getCachePathAppBin ());
1502+
1503+ // works with Android 8, but not 14
1504+ starter .setPacketsReceiptNotificationsValue ( 5 );
1505+ // starter.setForceScanningForNewAddressInLegacyDfu(true);
1506+ // starter.disableMtuRequest();
1507+
14931508 final DfuServiceController controller = starter .start (this , DfuService .class );
14941509 }
14951510 }
0 commit comments