@@ -12,6 +12,7 @@ import Server from './modules/server/index.js'
12
12
import User from './modules/user.js'
13
13
import AppStore from './modules/apps/app-store.js'
14
14
import Apps from './modules/apps/apps.js'
15
+ import { detectDevice , setCpuGovernor } from './modules/system.js'
15
16
16
17
import { commitOsPartition } from './modules/system.js'
17
18
@@ -69,6 +70,20 @@ export default class Umbreld {
69
70
this . apps = new Apps ( this )
70
71
}
71
72
73
+ async setupPiCpuGoverner ( ) {
74
+ // TODO: Move this to a system module
75
+ // Set ondemand cpu governer for Raspberry Pi
76
+ try {
77
+ const { productName} = await detectDevice ( )
78
+ if ( productName === 'Raspberry Pi' ) {
79
+ await setCpuGovernor ( 'ondemand' )
80
+ this . logger . log ( `Set ondemand cpu governor` )
81
+ }
82
+ } catch ( error ) {
83
+ this . logger . error ( `Failed to set ondemand cpu governor: ${ ( error as Error ) . message } ` )
84
+ }
85
+ }
86
+
72
87
async start ( ) {
73
88
this . logger . log ( `☂️ Starting Umbrel v${ this . version } ` )
74
89
this . logger . log ( )
@@ -80,6 +95,9 @@ export default class Umbreld {
80
95
// If we've successfully booted then commit to the current OS partition
81
96
commitOsPartition ( this )
82
97
98
+ // Set ondemand cpu governer for Raspberry Pi
99
+ this . setupPiCpuGoverner ( )
100
+
83
101
// Run migration module before anything else
84
102
// TODO: think through if we want to allow the server module to run before migration.
85
103
// It might be useful if we add more complicated migrations so we can signal progress.
0 commit comments