Skip to content

LLViewerJoystick::saveDeviceIdToSettings - JoystickDeviceUUID fails to set string #6140

Description

@Martin-Pitt

gSavedSettings.setLLSD("JoystickDeviceUUID", LLSD(device_string));

The viewer fails to persist the selected joystick setting because the control is set to TYPE_LLSD, which reparses any string handed over as LLSD notation (per LLControlVariable::getComparableValue)

This is because GUID strings read like "{9C06AF00-6854-11EF-8001-444553540000}", which looks like a map to LLSD because the GUID starts with a brace.

Therefore the root cause of the bug in failing to persist the joystick is that the viewer ends up storing the ID as {} only for every device picked.

For testing, 1) start the viewer (you don't need to login for this), 2) open debug settings to JoystickDeviceUUID and observe the value with the next steps. 3) Open preferences Move & View -> Movement -> Joystick Configuration. 4) Change the selected joystick.
If this were to works correctly in theory, the JoystickDeviceUUID should update with the selected device ID. However with this bug {} is stored instead.

One fix in LLViewerJoystick::saveDeviceIdToSettings could be to save the device ID in proper LLSD object format, e.g.:

    LLSD device_data;
    device_data["guid"] = device_string;
    gSavedSettings.setLLSD("JoystickDeviceUUID", device_data);

and then in LLViewerJoystick::loadDeviceIdFromSettings just below to parse it correctly:

    if (dev_id.isMap())
    {
        device_string = dev_id["guid"].asString();
    }
    else if (dev_id.isString())
    {
        device_string = dev_id.asString();
    }

Issue #1841 may be related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions