Trim support on the Argon M.2

I have a couple Argon One M.2 v.1 (with micro hdmi ports) cases and they lacked trim support with my Kingston A400 SSDs. A little google-foo turned up some good links, here, here and the firmware from here.

After working through the links, I managed to get trim support working. However, on reboot, the discard_max_bytes kept being set to the same value as discard_max_hw_bytes and I would get an error when attempting to run fstrim -v /.

fstrim: /: FITRIM ioctl failed: Remote I/O error

So I modified the suggested udev rule which resolves the issue:

#For some reason this rule does not work... so second runs a command
#KERNEL=="sda", SUBSYSTEM=="block", ATTR{queue/discard_max_bytes}="2147450880"

KERNEL=="sda", SUBSYSTEM=="block", RUN+="/bin/sh -c 'echo 2147450880 > /sys/block/sda/queue/discard_max_bytes'"
ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="55aa", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

Anyone know why the first rule does not work?

Edit: It appears the newer M.2 does have a version of firmware that supports trim but you still need to configure it.

Edit 2: The same value ( 2147450880 ) is used with the Samsung 860 EVO M.2 SATA

More fun with udev:

KERNEL=="sda", SUBSYSTEM=="block", ATTR{queue/discard_max_bytes}="2147450880", RUN+="/bin/sh -c 'cat /sys/block/sda/queue/discard_max_bytes'"

Interestingly, this works. Somehow, adding the RUN “causes” the value to be set? Riddle me that Batman.