USB HID play/pause working one way

Technical questions regarding the XTC tools and programming with XMOS.
en2senpai
Junior Member
Posts: 5
Joined: Mon Jul 19, 2021 7:32 am

USB HID play/pause working one way

Post by en2senpai »

Greetings,

Im currently working on USB Audio HID functionality of my device, and i've faced some strange behavior.

A PLAY/PAUSE functionality is working only one way (when the song is stopped - HID functionality will trigger it to start playing, but when the song is being played - HID functionality will NOT stop it as expected).

Do I need to report my changes more than one in a row ?

Here is my code snippet to test all needed functionalities (every 1000 requests from Host, device is simulating a HID action). Is this a proper way to handle this ?

Code: Select all

void UserReadHIDButtons(unsigned char hidData[])
{
    static int index = 0;

    index += 1;

    if (index == 1000)
    {
        hidData[0] = 0x02; // next track
    }
    else if (index == 2000)
    {
        hidData[0] = 0x04; // previous track
    }
    else if (index == 3000)
    {
        hidData[0] = 0x01; // play-pause
    }
    else if (index == 4000)
    {
        index = 0;
    }
}
Edit.
To test this, im using Tidal desktop app on Windows 10. Maybe this is a Tidal related issue ?