@phystack/screen-phyos 4.5.1-dev → 4.5.3-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +0 -42
- package/package.json +5 -5
- package/dist/sound.js +0 -83
package/dist/index.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -37,7 +14,6 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
37
14
|
// import { Settings } from './schema.js';
|
|
38
15
|
const screenshot_js_1 = require("./screenshot.js");
|
|
39
16
|
const sway_js_1 = require("./sway.js");
|
|
40
|
-
const sound = __importStar(require("./sound.js"));
|
|
41
17
|
const udev_js_1 = __importDefault(require("./udev.js"));
|
|
42
18
|
const browser_js_1 = __importDefault(require("./browser.js"));
|
|
43
19
|
const proxy_js_1 = __importDefault(require("./proxy.js"));
|
|
@@ -115,10 +91,6 @@ const logger = new phy_logger_1.PhyLogger({
|
|
|
115
91
|
properties.desired.screenResolution = 'default';
|
|
116
92
|
if (!properties.desired.screenOrientation)
|
|
117
93
|
properties.desired.screenOrientation = 'landscape';
|
|
118
|
-
if (!properties.desired.soundOutput)
|
|
119
|
-
properties.desired.soundOutput = 'hdmi1';
|
|
120
|
-
if (!properties.desired.soundInput)
|
|
121
|
-
properties.desired.soundInput = 'default';
|
|
122
94
|
if (!properties.desired.scale)
|
|
123
95
|
properties.desired.scale = '1.0';
|
|
124
96
|
logger.info('Desired settings retrieved', { desiredSettings: properties.desired });
|
|
@@ -129,15 +101,6 @@ const logger = new phy_logger_1.PhyLogger({
|
|
|
129
101
|
scale: properties.desired.scale,
|
|
130
102
|
headless: !(0, sway_js_1.isDrmAvailable)(),
|
|
131
103
|
});
|
|
132
|
-
sound.onDevices((devices) => {
|
|
133
|
-
const sound = devices.reduce((prev, { device, card, name }) => ({
|
|
134
|
-
...prev,
|
|
135
|
-
[`${card}:${device}`]: name,
|
|
136
|
-
}), {});
|
|
137
|
-
emitReportedProperties({ sound });
|
|
138
|
-
});
|
|
139
|
-
logger.info('Setting up sound output');
|
|
140
|
-
await sound.setup(properties.desired.soundOutput, properties.desired.soundInput);
|
|
141
104
|
// const onIoUpdated = async ({ inputs, outputs }: { inputs: any[]; outputs: any[] }) => {
|
|
142
105
|
// await mirror.activate(
|
|
143
106
|
// ScreenTransforms(module.settings.screen_orientation),
|
|
@@ -240,11 +203,6 @@ const logger = new phy_logger_1.PhyLogger({
|
|
|
240
203
|
// throw new Error('Failed to process screenshot');
|
|
241
204
|
// }
|
|
242
205
|
// });
|
|
243
|
-
// module.onMethod('sound_test', async (params) => {
|
|
244
|
-
// const { output = module.settings.sound_output } = params;
|
|
245
|
-
// const success = await sound.test(output);
|
|
246
|
-
// return success ? 'Success' : 'Failed';
|
|
247
|
-
// });
|
|
248
206
|
const checkHeartbeats = async () => {
|
|
249
207
|
while (true) {
|
|
250
208
|
await delay(60 * 1000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phystack/screen-phyos",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.3-dev",
|
|
4
4
|
"description": "PhyOS Screen",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@azure/storage-blob": "^12.23.0",
|
|
14
|
-
"@phystack/axios-proxy": "4.5.
|
|
15
|
-
"@phystack/hub-client": "4.5.
|
|
16
|
-
"@phystack/phy-logger": "4.5.
|
|
14
|
+
"@phystack/axios-proxy": "4.5.3-dev",
|
|
15
|
+
"@phystack/hub-client": "4.5.3-dev",
|
|
16
|
+
"@phystack/phy-logger": "4.5.3-dev",
|
|
17
17
|
"@vercel/ncc": "^0.38.1",
|
|
18
18
|
"get-image-colors": "^4.0.0",
|
|
19
19
|
"global-agent": "^3.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"lint": "eslint --ext .js,.ts src",
|
|
60
60
|
"lint-fix": "tsc --noEmit && eslint --ext .js,.ts src --fix && prettier --write ."
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "982cfdf11a3589ca7620afd6613863af27204366"
|
|
63
63
|
}
|
package/dist/sound.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.test = exports.onDevices = exports.setup = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
9
|
-
let onDevicesHandler = () => { };
|
|
10
|
-
async function setup(output, input) {
|
|
11
|
-
let cardId = 0;
|
|
12
|
-
let deviceId = 0;
|
|
13
|
-
const devices = child_process_1.default.execSync("aplay -l")
|
|
14
|
-
.toString().trim().split("\n")
|
|
15
|
-
.map(line => /^card ([0-9]+): .+, device ([0-9]+): (.+) \[(.+)\]$/.exec(line))
|
|
16
|
-
.filter(info => info)
|
|
17
|
-
.map(([_, card, device, name, displayName]) => ({
|
|
18
|
-
card: parseInt(card, 10),
|
|
19
|
-
device: parseInt(device, 10),
|
|
20
|
-
name,
|
|
21
|
-
displayName,
|
|
22
|
-
}));
|
|
23
|
-
onDevicesHandler(devices);
|
|
24
|
-
let device = null;
|
|
25
|
-
if (output === 'default') {
|
|
26
|
-
cardId = 0;
|
|
27
|
-
deviceId = 0;
|
|
28
|
-
}
|
|
29
|
-
else if (output === 'hdmi1') {
|
|
30
|
-
device = devices.find(({ name }) => name === 'HDMI 0')
|
|
31
|
-
|| devices.find(({ displayName }) => displayName === 'HDMI 0')
|
|
32
|
-
|| devices.find(({ name }) => name.indexOf('HDMI 0') >= 0)
|
|
33
|
-
|| devices.find(({ name }) => name.indexOf('HDMI') >= 0);
|
|
34
|
-
}
|
|
35
|
-
else if (output === 'hdmi2') {
|
|
36
|
-
device = devices.find(({ name }) => name === 'HDMI 1')
|
|
37
|
-
|| devices.find(({ displayName }) => displayName === 'HDMI 1')
|
|
38
|
-
|| devices.find(({ name }) => /HDMI 1/i.test(name))
|
|
39
|
-
|| devices.find(({ name }) => /HDMI/i.test(name));
|
|
40
|
-
}
|
|
41
|
-
else if (output === 'jack') {
|
|
42
|
-
device = devices.find(({ name }) => /headphones/i.test(name));
|
|
43
|
-
}
|
|
44
|
-
if (device) {
|
|
45
|
-
cardId = device.card;
|
|
46
|
-
deviceId = device.device;
|
|
47
|
-
}
|
|
48
|
-
const inputDeviceId = input === 'default' ? '0,0' : '1,0';
|
|
49
|
-
const cfg = [
|
|
50
|
-
`defaults.pcm.card ${cardId}`,
|
|
51
|
-
`defaults.pcm.device ${deviceId}`,
|
|
52
|
-
`defaults.ctl.card ${cardId}`,
|
|
53
|
-
`pcm.!default {`,
|
|
54
|
-
` type asym`,
|
|
55
|
-
` playback.pcm`,
|
|
56
|
-
` {`,
|
|
57
|
-
` type plug`,
|
|
58
|
-
` slave.pcm "plughw:${cardId},${deviceId}"`,
|
|
59
|
-
` }`,
|
|
60
|
-
` capture.pcm`,
|
|
61
|
-
` {`,
|
|
62
|
-
` type plug`,
|
|
63
|
-
` slave.pcm "plughw:${inputDeviceId}"`,
|
|
64
|
-
` }`,
|
|
65
|
-
`}`,
|
|
66
|
-
].join('\n');
|
|
67
|
-
await fs_1.default.promises.writeFile("/etc/asound.conf", cfg);
|
|
68
|
-
}
|
|
69
|
-
exports.setup = setup;
|
|
70
|
-
const onDevices = (handler) => { onDevicesHandler = handler; };
|
|
71
|
-
exports.onDevices = onDevices;
|
|
72
|
-
const test = async (output) => {
|
|
73
|
-
let out = output;
|
|
74
|
-
if (out === "jack")
|
|
75
|
-
out = "front";
|
|
76
|
-
if (/^hdmi[0-9]/.test(out))
|
|
77
|
-
out = 'hdmi';
|
|
78
|
-
const code = await new Promise(resolve => child_process_1.default
|
|
79
|
-
.spawn("speaker-test", ["-D", `plug:${out} `, "-c2", "-l", "1", "-t", "wav"], { stdio: 'inherit' })
|
|
80
|
-
.on('exit', resolve));
|
|
81
|
-
return code === 0;
|
|
82
|
-
};
|
|
83
|
-
exports.test = test;
|