Get Device Attached To Player Input

I am creating a local multiplayer game where I spawn players (with a player input component) using the input manager. I was wondering how I could access the device attached to the player input component of each player.

For instance, in my case, I would like to get the device, check if it is a ps4 gamepad and set the lightbar of that specific controller to be the player's color. I tried using DualShockGamepad.current but that only gets a single controller.

Is there any way I can do this in the new Input System?

I think you could probably cast the device from the device list from PlayerInput

DualShockGamepad ds4 = (DualShockGamepad)GetComponent<PlayerInput>().devices[0];

though you might have to do some checks to make sure that it's actually a DS4 controller as I assume this will error if the device is say an Xbox controller.

Thanks, it works.

For anyone interested, here is the code

var device = playerInput.devices[0];

if (device.GetType().ToString() == "UnityEngine.InputSystem.DualShock.DualShock4GamepadHID")
    DualShockGamepad ds4 = (DualShockGamepad)device;
    ds4.SetLightBarColor(playerController.GetComponent<Renderer>().material.color * colorIntensity);