[PATCH 04/10] api: new ReportKernelEvent() api method to report kernel device addition/removals

Aleksander Morgado aleksander at aleksander.es
Thu Sep 15 06:01:25 UTC 2016


On Mon, Aug 29, 2016 at 11:25 AM, Aleksander Morgado
<aleksander at aleksander.es> wrote:
>> In the API docs it talks about USB vid/pid, but MM does support at
>> least one PCI-native device; the Option Nozomi.  SDIO also uses 16-bit
>> vid/pid, though I'm not sure why anyone would use SDIO to hook up a
>> WWAN modem :)  Maybe just say it's a USB or PCI vid/pid for now, but
>> could be used for more in the future?
>>
>> Which means I'm not sure it should be a 'q'.  Maybe just an 's' with
>> guint16 validation for now?
>>
>
> Yes, that is a good idea, will try to update the patch to reflect that.
>

I started to do this change the other day and ended up not very happy
with it... Given that the physdev-vid and physdev-pid are not
mandatory in the call (it's totally fine to leave them out), I don't
think we should complicate what they mean or what they could mean. I
have a patch to explicitly avoid saying they're USB-only, though, see
attached 0001 patch. What do you think?

>> Also, would be nice to have some unit tests for the udev rules file
>> parsing code...
>>
>
> Oh, yes, indeed, should add that.

Aaand... this is getting too complex! :) See attached patch 0002 for
an ongoing attempt to have something unit-testable. The original
parser relies on being able to "jump" to the LABELs specified in GOTOs
when rules match, just by reading forward looking for the GOTO. This
means that not every rule is parsed for every device; the GOTOs make
sure only the ones applicable end up being applied. Now, if we want to
make the reading of the rules unit-testable we would need to load all
rules (e.g. just once) and keep them in memory for example, and then
apply the rules to the devices as they appear. What do you think of
this new approach? Does it make sense to do this?

-- 
Aleksander
https://aleksander.es
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-wip-unit-tests-for-udev-rules-parser.patch
Type: text/x-patch
Size: 21400 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20160915/db04d663/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-core-don-t-assume-VID-PID-are-USB-only.patch
Type: text/x-patch
Size: 4302 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20160915/db04d663/attachment-0003.bin>


More information about the ModemManager-devel mailing list