Open PieterGit opened 7 years ago
Linux kernel 4.4.30+ #919 Tue Nov 1 16:52:58 GMT 2016 armv6l GNU/Linux TI firmware 0.8 Same TI stick works fine with pi3.
pi@pi0:/etc/udev/rules.d $ cat 90-mmeowlink.rules
# symlink for TI Dongle flashed with subg_rfspy firmware
ATTR{idVendor}=="1d50", ATTR{idProduct}=="8001", MODE="0664", GROUP="plugdev", SYMLINK+="mmeowlink", RUN+="/usr/local/bin/mmt.sh"
the mmt.sh script does a mmtune
/usr/local/bin/mmtune.py --subg_rfspy --radio_locale WW --port /dev/ttyACMX --serial 123456
I found a workaround
$ cat /etc/udev/rules.d/90-mmeowlink.rules
# symlink for TI Dongle flashed with subg_rfspy firmware
ATTR{idVendor}=="1d50", ATTR{idProduct}=="8001", MODE="0664", GROUP="plugdev", SYMLINK+="mmeowlink", RUN+="/usr/local/bin/mmt.sh"
and $cat /usr/local/bin/mmt.sh
contains:
#!/bin/sh
echo `date ` mmtune start >> /var/log/openaps/mmtune.log
echo 'change link from ' >> /var/log/openaps/mmtune.log
ls -al /dev/mmeowlink >> /var/log/openaps/mmtune.log
d=`/home/pi/src/oref0/bin/oref0-find-ti-usb-device.sh`
sudo rm -rf /dev/mmeowlink
echo "to:"
sudo ln -s /dev/$d /dev/mmeowlink
ls -al /dev/mmeowlink >> /var/log/openaps/mmtune.log
/usr/local/bin/mmtune.py --subg_rfspy --radio_locale WW --port /dev/mmeowlink --serial 123456 >> /var/log/openaps/mmtune.log
echo `date ` mmtune end >> /var/log/openaps/mmtune.log
and
$ cat /home/pi/src/oref0/bin/oref0-find-ti-usb-device.sh
#!/bin/sh
usbid=`dmesg | grep "idVendor=1d50, idProduct=8001" | tail -n 1 | sed -e 's/^.*usb \([0-9\.\-]*\):.*$/\1/g'`
device=`dmesg | grep "cdc_acm $usbid" | tail -n 1 | sed -e 's/^.*: \(tty[A-Z0-9]*\): USB.*$/\1/g'`
echo $device
If there is anything I can do to fix this without the mmt.sh script I would be thankfull. Please let me know if I can help to fix this.
I think this also fix the serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')
. For example reported here: https://gitter.im/nightscout/intend-to-bolus?at=57ad0ac3613cc180367ba884 by @bfaloona
Hi Pieter. Currently worldwide pump support is problematic. The way we do it is that we run mmtune every time openaps runs - rather than in the udev rules. The radio frequency of the pump/ti stick change as temperature changes, for example. By doing things in udev rules, you're only running the tune once - when the ti stick is inserted or when the device is rebooted.
If you change things so that you run mmtune --radio_locale WW as part of your loop it'll re-tune as the day goes by and as the radio frequency drifts.
There's an existing issue for WW pump support here: https://github.com/oskarpearson/mmeowlink/issues/51 If it's ok, I'd like to close this as a duplicate of that item?
I don't think that the 'Inappropriate ioctl for device' issue is related to the WW pump issue. That might be a different bug, though. We'd need more information on where /dev/ttyACM0 or similar pointed at, and how it varied vs /dev/mmeowlink
@oskarpearson thanks for responding. I don't think this specific issue is WW only. I have seen quite some serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')
reports by people on https://gitter.im/nightscout/intend-to-bolus
Strange thing is that @mawhit reports it on a PI3 and I have no problems with the TI-stick on my PI3, but do have problems with a PI0.
Perhaps @bfaloona and @mawhit can let us know if they are using a worldwide (WW) or US pump. They both had serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')
because the SYMLINK option of udev chose to bind it to /dev/usb/x/y instead of /dev/ttyACMx for some unknown reason.
I'm using a US pump - MMT723. Not having any issues at the moment though.
when i use the udev rules i end up with a symlink like this:
instead of a symlink to ttyACM.
Communicating is not possible and give various errors, such as
or
When I change the symlink to
/dev/ttyACM<x>
i can communiate with the pump.