Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ A C and Python library for use with the Widgetlords [WL-MIO](https://wlmio.com/)

## Dependencies

- Python 3.9
- libcanard (MIT)
- libgpiod (LGPL-2.1)

## Package for Raspberry Pi

Download a (Release)[https://github.com/widgetlords/libwlmio/releases]

OR build your own package

```
apt install devscripts meson libgpiod-dev python3-dev
apt install devscripts meson libgpiod-dev python3-dev debhelper pkg-config
debuild -b -us -uc -i
```
3 changes: 2 additions & 1 deletion debian/postinst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
cp /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/overlays/
cp /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/firmware/overlays/
cp /usr/share/rpikernelhack/overlays/wlmio-pi5.dtbo /boot/firmware/overlays/
rm -rf /usr/share/rpikernelhack/
7 changes: 5 additions & 2 deletions debian/postrm
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh
if test "$1" = remove -a "$1" = abort-install -a "$1" = disappear;
then
dpkg-divert --no-rename --remove --package rpikernelhack /boot/overlays/wlmio.dtbo
rm /boot/overlays/wlmio.dtbo
dpkg-divert --no-rename --remove --package rpikernelhack /boot/firmware/overlays/wlmio.dtbo
rm /boot/firmware/overlays/wlmio.dtbo

dpkg-divert --no-rename --remove --package rpikernelhack /boot/firmware/overlays/wlmio-pi5.dtbo
rm /boot/firmware/overlays/wlmio-pi5.dtbo
fi
3 changes: 2 additions & 1 deletion debian/preinst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
mkdir -p /usr/share/rpikernelhack/overlays/
dpkg-divert --no-rename --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/overlays/wlmio.dtbo
dpkg-divert --no-rename --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/firmware/overlays/wlmio.dtbo
dpkg-divert --no-rename --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/wlmio-pi5.dtbo /boot/firmware/overlays/wlmio-pi5.dtbo
15 changes: 14 additions & 1 deletion overlay/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ overlay = custom_target('wlmio.dtbo',
command: [ dtc, '-@', '-I', 'dts', '-O', 'dtb', '-o', '@OUTPUT@', '@INPUT@' ],
build_by_default: true,
install: true,
install_dir: '/boot/overlays/',
install_dir: '/boot/firmware/overlays/',
# install_dir: '/usr/share/rpikernelhack/overlays/',
install_mode: ['rwxr-xr-x', 'root', 'root']
# install_mode: 'rwxr-xr-x'
)

overlay = custom_target('wlmio-pi5.dtbo',
output: 'wlmio-pi5.dtbo',
input: 'wlmio-pi5.dts',
command: [ dtc, '-@', '-I', 'dts', '-O', 'dtb', '-o', '@OUTPUT@', '@INPUT@' ],
build_by_default: true,
install: true,
install_dir: '/boot/firmware/overlays/',
# install_dir: '/usr/share/rpikernelhack/overlays/',
install_mode: ['rwxr-xr-x', 'root', 'root']
# install_mode: 'rwxr-xr-x'
)

111 changes: 111 additions & 0 deletions overlay/wlmio-pi5.dts
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like this should be achieved via overlay_map.dtb with the common bits being targeted at any platform and the chip specific UART separately.

I tested breaking out the fragments it seemed to work as well as the whole file but the compatible directive doesn't seem to exclude application.

My current workaround is using dtoverlay wlmio-pi5

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to remove overlays entirely for this package. overlay_map.dtb is a hack. Instead we are going to ship a wlmio.txt to be included with include wlmio.txt in config.txt that will handle all of the platform differences in an easy way for users.

There is a symlink to /boot/firmware/overlays at /boot/overlays so I think we will rely on this for now to support bullseye.

Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2712";

fragment@0 {
target = <&spi0>;
__overlay__ {
status = "okay";
};
};

fragment@1 {
target = <&spidev0>;
__overlay__ {
status = "disabled";
};
};

fragment@2 {
target = <&gpio>;
__overlay__ {
can_pins: can_spi0_0_pins {
brcm,pins = <6 16>;
brcm,function = <0 0>; // GPIO INPUT
brcm,pull = <2 2>; // PULL-UP
};
};
};

fragment@3 {
target-path = "/clocks";
__overlay__ {
can_osc: can_spi0_0_osc {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <40000000>;
};
};
};

fragment@4 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;

can: mcp2518fd@0 {
compatible = "microchip,mcp2518fd";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&can_pins>;
spi-max-frequency = <20000000>;
interrupt-parent = <&gpio>;
interrupts = <6 8>; // IRQ_TYPE_LEVEL_LOW
// interrupts-extended = <&gpio 6 8>; // IRQ_TYPE_LEVEL_LOW
clocks = <&can_osc>;
microchip,rx-int-gpios = <&gpio 16 1>; // GPIO_ACTIVE_LOW
};

};
};

fragment@5 {
target = <&i2c_arm>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

mcp7941x: mcp7941x@6f {
compatible = "microchip,mcp7941x";
reg = <0x6f>;
status = "okay";
};
};
};

fragment@6 {
target = <&uart2>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
};
};

fragment@7 {
target = <&uart4>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins>;
status = "okay";
};
};

fragment@8 {
target = <&gpio>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uavcan_address>;

uavcan_address: uavcan_address {
brcm,pins = <21 22 23 24 25 26 27>;
brcm,function = <0 0 0 0 0 0 0>; // GPIO INPUT
brcm,pull = <2 2 2 2 2 2 2>; // PULL-UP
};
};
};
};
26 changes: 13 additions & 13 deletions src/tools/meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
executable('6040macal', '6040macal.c', dependencies: [wlmio_dep], install: true)
executable('6050cal', '6050cal.c', dependencies: [wlmio_dep], install: true)
executable('6070cal', '6070cal.c', dependencies: [wlmio_dep], install: true)
executable('6090cal', '6090cal.c', dependencies: [wlmio_dep], install: true)
executable('6090ccal', '6090ccal.c', dependencies: [wlmio_dep], install: true)
executable('6180a_cal', '6180a_cal.c', dependencies: [wlmio_dep], install: true)
executable('6190a_conf', '6190a_conf.c', dependencies: [wlmio_dep], install: true)
executable('factoryreset', 'factoryreset.c', dependencies: [wlmio_dep], install: true)
executable('fwupdate', 'fwupdate.c', dependencies: [canard_dep, libgpiod_dep], install: true)
executable('infodump', 'infodump.c', dependencies: [wlmio_dep], install: true)
executable('monitor', 'monitor.c', dependencies: [wlmio_dep], install: true)
executable('regtool', 'regtool.c', dependencies: [wlmio_dep], install: true)
executable('store', 'store.c', dependencies: [wlmio_dep], install: true)
executable('wl_6040macal', '6040macal.c', dependencies: [wlmio_dep], install: true)
executable('wl_6050cal', '6050cal.c', dependencies: [wlmio_dep], install: true)
executable('wl_6070cal', '6070cal.c', dependencies: [wlmio_dep], install: true)
executable('wl_6090cal', '6090cal.c', dependencies: [wlmio_dep], install: true)
executable('wl_6090ccal', '6090ccal.c', dependencies: [wlmio_dep], install: true)
executable('wl_6180a_cal', '6180a_cal.c', dependencies: [wlmio_dep], install: true)
executable('wl_6190a_conf', '6190a_conf.c', dependencies: [wlmio_dep], install: true)
executable('wl_factoryreset', 'factoryreset.c', dependencies: [wlmio_dep], install: true)
executable('wl_fwupdate', 'fwupdate.c', dependencies: [canard_dep, libgpiod_dep], install: true)
executable('wl_infodump', 'infodump.c', dependencies: [wlmio_dep], install: true)
executable('wl_monitor', 'monitor.c', dependencies: [wlmio_dep], install: true)
executable('wl_regtool', 'regtool.c', dependencies: [wlmio_dep], install: true)
executable('wl_store', 'store.c', dependencies: [wlmio_dep], install: true)
Comment on lines +8 to +13
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These names specifically are problematic in their generic nature the better alternative might be changing the prefix to /usr/libexec/widgetlords/ or /opt/widgetlords/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you seen any conflicts in the wild?