On Mon, 2012-10-01 at 12:02 +0300, Juho Hämäläinen wrote:
> On 01.10.2012 11:28, Tanu Kaskinen wrote:
> > What's the problem that you're having? I'm only familiar with
> > PulseAudio's use, I don't know where else /etc/boardname is being used
> > (well, ohmd was mentioned in the discussion that you linked to). In
> > PulseAudio's case, I think this would be a sufficient specification:
> >
> > The boardname is a 7-bit ASCII (UTF-8 could be specified too, if a
> > larger character space is necessary) string, not containing null bytes.
> > The string is divided into non-empty fields using '_' as the field
> > separator. The fields are hierarchically ordered: the first field is the
> > most generic one, and each successive field is a specifier for the
> > previous hierarchy level.
> >
> > That specification would allow PulseAudio to load hw-specific
> > configuration files, first trying a file name with the full boardname,
> > and if the file is not found, keep trying more and more generic
> > boardnames by removing the last field one by one.
>
> This sounds good as well. But again, not-accepted chars or spaces or
> whatever, if they are replaced, need to be replaced with someting else
> than field separator. Having fixed field count is not that important,
> but some sane way to discern different fields is.
I don't think it's necessary to distinguish between replaced characters
and field separators. Not making the distinction would lead to trying
more file names, which is not nice, but things would still work.
Here's another solution that doesn't require changing the boardname
script: PulseAudio could have directory /etc/pulse/boardnames.d/ or
something like that, and each file in that directory would contain a
regular expression and the configuration file name. For example:
^arm_nokia_rx_51_board
nokia_rx_51.conf
The first line matches all revisions of the RX-51 board, and the second
line tells which file to load. PulseAudio would read all regular
expressions in the boardnames.d directory, and compare /etc/boardname
against each of them until a match is found.
What do you think? I like this more than my previous suggestion of
trying to repeatedly open files each time removing one field.
Yet another approach would be to see if the configuration file name is a
prefix of the boardname. It would be less flexible, but it would be
simpler. There may not be need for more flexibility than prefix
matching.
--
Tanu