depthai-core icon indicating copy to clipboard operation
depthai-core copied to clipboard

[Feature-Request] Modify USB pid

Open ibaiGorordo opened this issue 1 year ago • 4 comments

Start with the why:

In certain systems, the fact that the USB device profile changes when the device is started and closed generates some issues. Like WSL (Ref: https://discuss.luxonis.com/d/693-i-got-depthai-demo-to-run-in-wsl/4) or Android (even though it is not officially supported) with USB permissions.

Move to the what:

I have tried flashing a config with a new pid value to match the pid defined when the device starts (code below), but even though the config is flashed correctly, the device pid is not changed. Since the Device Manager example does not give the option to modify the pid, does it mean that it is not possible to modify it?

# Create pipeline
pipeline = dai.Pipeline()

# Set board config
config = dai.DeviceBootloader.Config()
config.usb.pid = 0xf63b

(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()
with dai.DeviceBootloader(info) as bootloader:
    progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
    (r, errmsg) = bootloader.flashConfig(config)
    if r:
        print("Flashed successfully")
    else:
        print(f"Error: {errmsg}")

(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()
with dai.DeviceBootloader(info) as bootloader:
    print('Current flashed configuration')
    print(json.dumps(bootloader.readConfigData()))

On the other hand, is it possible to modify the pid value when the device starts? I have tried also something like this but with no luck either:

dai::BoardConfig boardConfig;
boardConfig.usb.pid = 0x03E7;
pipeline.setBoardConfig(boardConfig);

I have also looked checked about standalone app so that it will automatically boot and avoid having the pre-boot pid, but in my case, I want to get access to the data from the OAKD using the XLINKOut nodes, so I think it would be possible.

It would be great if there was some way to do it.

Move to the how:

No other ideas apart what is mentioned above.

Thanks!

ibaiGorordo avatar Jul 18 '23 05:07 ibaiGorordo