Skip to content

Commit

Permalink
manager: skip USB for non-supported targets
Browse files Browse the repository at this point in the history
Fixes #2272
  • Loading branch information
osy committed Jan 17, 2021
1 parent 1cb647b commit 90a9461
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Configuration/UTMConfiguration+Defaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ - (void)loadDefaultsForTarget:(NSString *)target {
self.shareClipboardEnabled = YES;
} else if ([target isEqualToString:@"mac99"]) {
self.soundEnabled = NO;
} else if ([target isEqualToString:@"isapc"]) {
self.inputLegacy = YES; // no USB support
}
NSString *machineProp = [UTMConfiguration defaultMachinePropertiesForTarget:target];
if (machineProp) {
Expand Down
9 changes: 8 additions & 1 deletion Managers/UTMQemuSystem.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ @interface UTMQemuSystem ()
@property (nonatomic, readonly) CPUCount emulatedCpuCount;
@property (nonatomic, readonly) BOOL useHypervisor;
@property (nonatomic, readonly) BOOL hasCustomBios;
@property (nonatomic, readonly) BOOL usbSupported;

@end

Expand Down Expand Up @@ -411,6 +412,10 @@ - (BOOL)hasCustomBios {
return NO;
}

- (BOOL)usbSupported {
return ![self.configuration.systemTarget isEqualToString:@"isapc"];
}

- (NSString *)machineProperties {
if (self.configuration.systemMachineProperties.length > 0) {
return self.configuration.systemMachineProperties; // use specified properties
Expand Down Expand Up @@ -482,7 +487,9 @@ - (void)argsFromConfiguration {
}
[self pushArgv:@"-name"];
[self pushArgv:self.configuration.name];
[self argsForUsb];
if (self.usbSupported) {
[self argsForUsb];
}
[self argsForDrives];
[self argsForNetwork];
if (self.snapshot) {
Expand Down

0 comments on commit 90a9461

Please sign in to comment.