Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docker-compose-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ services:
container_name: devicehub-processor
env_file:
- scripts/variables.env
command: stf processor --name processor --connect-app-dealer tcp://devicehub-triproxy-app:7160 --connect-dev-dealer tcp://devicehub-triproxy-dev:7260
command: >
stf processor --name processor
--connect-app-dealer tcp://devicehub-triproxy-app:7160
--connect-dev-dealer tcp://devicehub-triproxy-dev:7260
--connect-push tcp://devicehub-triproxy-app:7170
--connect-push-dev tcp://devicehub-triproxy-dev:7270
--connect-sub tcp://devicehub-triproxy-app:7150
--connect-sub-dev tcp://devicehub-triproxy-dev:7250
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand Down Expand Up @@ -233,7 +240,12 @@ services:
container_name: devicehub-api-groups-engine
env_file:
- scripts/variables.env
command: stf groups-engine --connect-push tcp://devicehub-triproxy-app:7170 --connect-push-dev tcp://devicehub-triproxy-dev:7270
command: >
stf groups-engine
--connect-push tcp://devicehub-triproxy-app:7170
--connect-push-dev tcp://devicehub-triproxy-dev:7270
--connect-sub tcp://devicehub-triproxy-app:7150
--connect-sub-dev tcp://devicehub-triproxy-dev:7250
depends_on:
devicehub-migrate:
condition: service_completed_successfully
Expand Down
22 changes: 21 additions & 1 deletion lib/units/ios-provider/IOSObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,40 @@ export default class IOSObserver extends EventEmitter<IOSSimEvents> {
return serial
}

private isValidIosUsbSerial(rawSerial: string): boolean {
// Raw iOS UDID often comes as 24 hex chars from usb-hotplug.
const raw24 = /^[0-9A-Fa-f]{24}$/
// Some tools expose 40-char lower/upper hex.
const raw40 = /^[0-9A-Fa-f]{40}$/
// After formatting 24-char UDID becomes XXXXXXXX-XXXXXXXXXXXXXXXX.
const formatted8x16 = /^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{16}$/
// Simulator UUID format (kept for completeness in case usb source changes).
const simUuid = /^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/

const formatted = this.formatUDID(rawSerial)
return raw24.test(rawSerial) ||
raw40.test(rawSerial) ||
formatted8x16.test(formatted) ||
simUuid.test(formatted)
}

listen = (): void => {
new Promise(async() => {
if (!this.usbListenerStarted) {
const currentDevices = usb.listDevices()
for (const device of currentDevices) {
if (!device.serialNumber || device.vendorId !== 1452) continue
if (!this.isValidIosUsbSerial(device.serialNumber)) continue
this.emit('attached', this.formatUDID(device.serialNumber), false)
}

usb.watchDevices((err, event) => {
if (!event.serialNumber) {
return
}
if (!this.isValidIosUsbSerial(event.serialNumber)) {
return
}

if (event.eventType === 'Connected' && event.device?.vendorId === 1452) {
Copy link
Copy Markdown
Collaborator

@e-khalilov e-khalilov Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, devices are filtered by device.vendorId. Have you tried adding filtering by device.deviceClass? The mouse/keyboard must be marked as Human Interface Device, so regular expressions won't be necessary.

this.emit('attached', this.formatUDID(event.serialNumber), false)
Expand All @@ -117,4 +138,3 @@ export default class IOSObserver extends EventEmitter<IOSSimEvents> {
clearTimeout(this.listnerInterval)
}
}