All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Mengdong Lin <mengdong.lin@linux.intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"tiwai@suse.de" <tiwai@suse.de>,
	"Lin, Mengdong" <mengdong.lin@intel.com>,
	"Koul, Vinod" <vinod.koul@intel.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"Bossart, Pierre-louis" <pierre-louis.bossart@intel.com>
Subject: Re: [PATCH 1/2] ucm: Automatically load the best config file based on the card long name
Date: Fri, 23 Dec 2016 09:07:40 +0000	[thread overview]
Message-ID: <1482484060.24233.58.camel@loki> (raw)
In-Reply-To: <585CDB6D.7000401@linux.intel.com>

On Fri, 2016-12-23 at 16:08 +0800, Mengdong Lin wrote:
> On 12/22/2016 11:35 PM, Liam Girdwood wrote:
> 
> >>>>>> +/* This function will find the best device-specific configuration
> >>>>>> +file based
> >>>>>> + * on the sound card long name.
> >>>>>> + * Different devices may share the same sound driver and thus the
> >>>>>> +same sound
> >>>>>> + * card name (short name), but they may still need different
> >>>>>> +device-specific
> >>>>>> + * configurations. For user space to differentiate them, kernel
> >>>>>> +drivers may
> >>>>>> + * include the DMI info (vendor, product and board) in the card
> >>>>>> +long
> >>>>> name.
> >>>>>> + * And user space can define configuration file names appending
> >>>>>> +DMI keywords
> >>>>>> + * to the card name, like:
> >>>>>> + * bytcr-rt5640.ASUS.T100
> >>>>>> + * bytcr-rt5651.MinnowBoard
> >>>>>> + *
> >>>>>> + * When being asked to load the configuration file for a card,
> >>>>>> +this function
> >>>>>> + * will try to find the card long name from the local machine,
> >>>>>> +and then scan
> >>>>>> + * all available configuration file names, search every field of
> >>>>>> +the config
> >>>>>> + * file name in the card long name. The more characters match,
> >>>>>> +the higher
> >>>>>> + * score the file has. Finally, the file with the highest score will be
> >>> loaded.
> >>>>>> + */
> >>>>>
> >>>>> Id' expect this function to try and open card longname and then card
> >>>>> name if longname is not found. So providing we use the exact same
> >>>>> names as the DMI name we wont need any string formatting or scoring
> >>>>> (i.e. file
> >>>>> open("longname/longname.conf") will either succeed or fail)
> >>>>>
> >>>>> Liam
> >>>>
> >>>> I feel we cannot use the exact same names for the configuration file
> >>>> and card long name. The DMI info in the card long name can be lengthy,
> >>>> including '.' , SPACE, meaningless info like "Corp." and sometime
> >>>> duplicated info for some OEMs.I hope developers can just extract key
> >>>> words from the messy DMI info to make a simple configuration file
> >>>> name, and UCM automatically do the matching and give each
> >>>> configuration file a score. Then the file with highest score will be
> >>>> used for the card.
> >>>
> >>> Providing the DMI name does not use invalid filename characters we are ok.
> >>> Extracting key words and matching is prone to many problems and painful to
> >>> debug....
> >>
> >> May I revise the UCM code like this? It will try to open the file with
> >> DMI name at first. And only if that file is not available, fall back
> >> to key words matching.
> >>
> >> I hope to keep the possibility that user can use a simple
> >> configuration file for a product family, without generating too many
> >> card directories and files.
> >>
> >
> > If the DMI names are too complex for directory names, then you could add
> > an alias file at the top level that would list the DMI name and the
> > shortened name i.e.
> >
> > # DMI name                     # UCM directory name
> > "Dell blah Corp. XPS, 13 blah" "Dell XPS13 BDW"
> >
> > So the alias file could be searched for the DMI name, before the legacy
> > name was tried.
> >
> > The alias method above also allows for reuse of configs on machines that
> > are similar, but with different DMI names. So this would also keep the
> > number of configs low.
> >
> > Liam
> 
> I'll try to use the alias file. But it seems we need to maintain a lot 
> of entries in the file :-(
> 
> In addition, I found we cannot use paths with SPACE as the UCM directory 
> name. Autoconf cannot support this. It complains although I tried \ or " 
> to escape. We need something like "Dell.XPS13.BDW" as the UCM directory 
> names.
> 

Gah, it looks like autoconf may have defeated this ! Autoconf has
special uses for some chars in names.

So you may want to "fix" the DMI name to exclude any special chars when
creating your longname (maybe also set a shorter length too). I still
dont want any scoring, we just want to open the "longname.conf" then
"drivername.conf"

Liam


_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2016-12-23  9:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 13:09 [PATCH 1/2] ucm: Automatically load the best config file based on the card long name mengdong.lin
2016-12-21 14:38 ` Liam Girdwood
2016-12-21 16:12   ` Lin, Mengdong
2016-12-22  3:00     ` Mengdong Lin
2016-12-22 12:14     ` Liam Girdwood
2016-12-22 14:35       ` Lin, Mengdong
2016-12-22 15:35         ` Liam Girdwood
2016-12-23  8:08           ` Mengdong Lin
2016-12-23  9:07             ` Liam Girdwood [this message]
2016-12-23 12:56               ` Lin, Mengdong
2016-12-21 14:46 ` Pierre-Louis Bossart
2016-12-21 16:24   ` Lin, Mengdong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482484060.24233.58.camel@loki \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=mengdong.lin@intel.com \
    --cc=mengdong.lin@linux.intel.com \
    --cc=pierre-louis.bossart@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.