Skip to contentSkip to conversation

net: Z-Wave driver prototype

RFC In review Andreas Färber 2 participants 3 messages Jan 20, 2019 – Jan 21, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 net: Z-Wave driver prototype

Inspired from my LoRa and FSK driver project, I've hacked together a PoC for an in-kernel Z-Wave driver. Tested with Pine64 Z-Wave module.

The by now SiLabs ZM5304 module exposes a UART interface that this serdev driver can be attached to, using Device Tree.

There didn't appear to be any schematics for the Pine64 Z-Wave adapter, so the reset GPIO handling is still missing.

Helpers are implemented for dealing with command, response and respective checksum-based acknowledgements.

While by now there is extensive public documentation on Command Classes for individual types of Z-Wave devices, I still couldn't find any proper documentation of the UART protocol below and relied on a former tutorial by Henrik Leidecker Jørgensen documenting commands for device discovery.

Tested as external kernel module, so Kconfig/Makefile integration missing.

Some ideas where to take this from here:
1) Try to expose this as a net device and leave node communication to userspace via sockets (command/response as skb?) or other means.
2) Make this its own, e.g., drivers/zwave/ subsystem as bus and create individual drivers (iio, gpio, led, etc.) for the various node types. Optionally, implement a zwave-dev driver for generic userspace access to one particular node, similar to spidev.

Note: Z-Wave is based on GFSK modulation, so someone with a lot of time might implement it based on the FSK drivers being created alongside LoRa. That speaks against relying on the serial protocol, and it would not work with any tty based userspace applications.

---
 drivers/net/zwave/Makefile |   1 +
 drivers/net/zwave/zwave.c  | 236 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 237 insertions(+)
 create mode 100644 drivers/net/zwave/Makefile
 create mode 100644 drivers/net/zwave/zwave.c
drivers/net/zwave/Makefile new file +1 -0
new file mode 100644
index 000000000000..1a4171308c79
@@ -0,0 +1 @@
+obj-m += zwave.o
drivers/net/zwave/zwave.c new file +236 -0

236 lines not on this page · raw message

Signature · 1 line
2.16.4
#1 lore raw

drivers/net/zwave/Makefile line 1

Quoted 7 lines · Andreas Färber
drivers/net/zwave/Makefile new file +1 -0
new file mode 100644
index 000000000000..1a4171308c79
@@ -0,0 +1 @@
+obj-m += zwave.o

Hi,

This will need a Kconfig file and a symbol so that the Makefile will not always build the zwave module.

thanks,

Signature · 1 line
~Randy
#2 lore raw

Hi,

Am 20.01.19 um 19:56 schrieb Randy Dunlap:

Quoted 2 lines · Andreas Färber
Quoted 1 line

Tested as external kernel module, so Kconfig/Makefile integration missing.

[...]

Quoted 10 lines

drivers/net/zwave/Makefile line 1

Quoted 7 lines
drivers/net/zwave/Makefile new file +1 -0
new file mode 100644
index 000000000000..1a4171308c79
@@ -0,0 +1 @@
+obj-m += zwave.o

This will need a Kconfig file and a symbol so that the Makefile will not always build the zwave module.

Well, as I noted in the commit message you cut off, this Makefile is not included from drivers/net/. So it should actually not get built at all, unless you build it explicitly as module:

$ make -C /lib/modules/`uname -r`/build M=$PWD/drivers/net/zwave

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/modules.txt?id=HEAD

This RFC is nowhere near merging, so there's no point in bike-shedding about Kconfig help texts. The Kconfig/Makefile integration depends on the alternatives outlined in the commit message of what to make of this. Right now it does not expose any netdev nor any other useful interfaces, merely demonstrating that via serdev it could be handled in the kernel.

The big context here is RF ASICs vs. SDR and the layering of PHY and MAC implementations and their user-facing (socket) interfaces. Cf. slide 24:
https://events.linuxfoundation.org/wp-content/uploads/2017/12/ELCE2018_LoRa_final_Andreas-Farber.pdf
(Z-Wave was marked in orange as not-entirely-open protocol over FSK.)

I had this Z-Wave module lying around, so I gave it a quick shot to get a feeling for the protocol in comparison. If no one finds the RFC useful then it can die as quickly as it came to life. :)

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)