Re: [PATCH][RFC][ModemManager] udev rules: port to hwdb where applicable



Hi Tom,

Udev recently gained a hardware database, which is an efficent replacement for
the kind of rules shipped with modemmanager.

This patch ports all the relevant udev rules to hwdb format, which should
significantly speed up the processing of usb add events.

I also fixed up some bugs in the existing udev rule files found in the process.

Only rudimentary testing done as I don't have the right hardware, so testing and
comments very much appreciated!

The hwdb files were generated from the udev rules using the following search and
replace's in vim:

:%s/ATTRS{idVendor}=="\(\x\{4}\)", ENV{\(\w*\)}="\(\w*\)"/usb:v\U\1\E*\r \2=\3/g
:%s/ATTRS{idVendor}=="\(\x\{4}\)", ATTRS{idProduct}=="\(\x\{4}\)", 
ENV{\(\w*\)}="\(\w*\)"/usb:v\U\1\Ep\U\2\E*\r \3=\4/g
:%s/ATTRS{idVendor}=="\(\x\{4}\)", ATTRS{idProduct}=="\(\x\{4}\)", ENV{.MM_USBIFNUM}=="\(\x\{2}\)", 
ENV{\(\w*\)}="\(\w*\)"/usb:v\U\1\Ep\U\2\Ed*dc*dsc*d
p*ic*isc*ip*in\U\3\E\r \4=\5/g

and for plugins/huawei:

:%s/SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="\(\x\{2}\)", ATTRS{bInterfaceSubClass}=="\(\x\{2}\)", 
ATTRS{bInterfaceProtocol}=="\(\x\{2}\)", ENV{\(\w
*\)}="\(\w*\)"/usb:v12D1p*d*dc\U\1\Edsc\U\2\Edp\U\3\E\r \4=\5

(and some manual editing)
---
configure.ac                                      |   1 +
plugins/Makefile.am                               |  39 +++
plugins/huawei/20-mm-huawei-net-port-types.hwdb   |  21 ++
plugins/huawei/77-mm-huawei-net-port-types.rules  |   4 +-
plugins/longcheer/20-mm-longcheer-port-types.hwdb | 350 +++++++++++++++++++++
plugins/mbm/20-mm-ericsson-mbm.hwdb               | 166 ++++++++++
plugins/nokia/20-mm-nokia-port-types.hwdb         |  42 +++
plugins/simtech/20-mm-simtech-port-types.hwdb     |  43 +++
plugins/telit/20-mm-telit-port-types.hwdb         |  70 +++++
plugins/x22x/20-mm-x22x-port-types.hwdb           |  87 ++++++
plugins/zte/20-mm-zte-port-types.hwdb             | 355 ++++++++++++++++++++++
plugins/zte/77-mm-zte-port-types-2.rules          |   9 +
plugins/zte/77-mm-zte-port-types.rules            |   3 -
src/20-mm-usb-device-blacklist.hwdb               | 132 ++++++++
src/20-mm-usb-serial-adapters-greylist.hwdb       |  40 +++
src/77-mm-usb-device-blacklist.rules              |   4 +-
src/Makefile.am                                   |  15 +-
17 files changed, 1372 insertions(+), 9 deletions(-)
create mode 100644 plugins/huawei/20-mm-huawei-net-port-types.hwdb
create mode 100644 plugins/longcheer/20-mm-longcheer-port-types.hwdb
create mode 100644 plugins/mbm/20-mm-ericsson-mbm.hwdb
create mode 100644 plugins/nokia/20-mm-nokia-port-types.hwdb
create mode 100644 plugins/simtech/20-mm-simtech-port-types.hwdb
create mode 100644 plugins/telit/20-mm-telit-port-types.hwdb
create mode 100644 plugins/x22x/20-mm-x22x-port-types.hwdb
create mode 100644 plugins/zte/20-mm-zte-port-types.hwdb
create mode 100644 plugins/zte/77-mm-zte-port-types-2.rules
create mode 100644 src/20-mm-usb-device-blacklist.hwdb
create mode 100644 src/20-mm-usb-serial-adapters-greylist.hwdb

it would be interesting if we could make this more generic and not just ModemManager specific. If we could 
create proper hwdb that can be both used by oFono and ModemManager, then we could gain something here. In 
addition they could be just merged into systemd directly.

Regards

Marcel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]