[PATCH 1/2] mmdevapi: Truncate strings from PropertyStore's GetValue to 62 chars.

Andrew Eikum aeikum at codeweavers.com
Tue May 24 10:24:33 CDT 2022


On Tue, May 24, 2022 at 05:48:58PM +0300, Gabriel Ivăncescu wrote:
> On 23/05/2022 19:18, Andrew Eikum wrote:
> > We could try to acquire a shorter name for the underlying device,
> > somehow, but I'm not sure what options PA and/or ALSA give us. Maybe
> > use PA_PROP_DEVICE_PRODUCT_NAME instead, for example.
> > 
> 
> I experimented with a few options. Unfortunately, they don't really work.
> 
> PA_PROP_DEVICE_PRODUCT_NAME is either not available in most cases, or it's
> the same as the description (which is what is currently used), and when it
> is different, the returned name is way too short (e.g. just "D30"). However
> the problem is that it's not available for "virtual" sources (or sinks), and
> in this case those are the largest offenders, e.g. "Monitor of <some really
> long name>" which makes the long name even longer.
> 
> In the case of the linked bug, it's the builtin soundcard (on motherboard)
> that is too long and it seems the product name won't help there at all
> anyway, even without the "Monitor of" source.
> 
> I was thinking of using the pulse_name in case the description is longer
> than 62 chars, but apparently those can get pretty long too. Though I
> suppose using it as a fallback should work in most cases... And pick it if
> it's shorter in such case.
> 

I don't know. I don't think it's great to truncate useful information
just to work around one game bug.

My best idea is to try to construct some useful string out of the
information we can get from Pulse. Looking at the pulse properties for
the hardware I happen to have, I see:

    device.description = "Starship/Matisse HD Audio Controller Digital Stereo (IEC958)"

This is pretty long. Here are some other names:

    device.product.name = "Starship/Matisse HD Audio Controller"
    device.profile.description = "Digital Stereo (IEC958)"
    alsa.card_name = "HD-Audio Generic"

Maybe we could use some combination of those? Maybe choose whichever
of device.product.name and alsa.card_name is shorter, and append the
profile description if it doesn't become too long?

As for monitoring, we can use:

    device.class = "monitor"

to build our own "Monitor of" string.

Andrew



More information about the wine-devel mailing list