On Wednesday, January 17, 2018 at 11:55:23 PM UTC+1, mwall wrote:
>
> On Wednesday, January 17, 2018 at 5:32:07 PM UTC-5, andr3id wrote:
>>
>> Anyway, with the information found on wxforum 
>> <https://www.wxforum.net/index.php?topic=27581.0>, I've managed to 
>> modify a linux kernel driver to make the WMR89 show up as a USB serial 
>> interface in Linux.
>>
>
> welcome!  could you post the instructions for what you did to modify the 
> kernel driver?  based on conversations with marunio, i wrote a wmr89 driver 
> that *should* properly decode data.  unfortunately, all of the hardware i 
> have at hand has serial drivers that refuse to permit the non-standard baud.
>

I will try to sum up what I've did in a future post. It was just a quick 
hack to make it work and not really a great solution.
Here are some hints if you want to try:

- You'll need all the tools to be able to build the kernel, the linux 
headers and the source code for the running kernel.

- The driver that WMR89 uses 
is 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/drivers/usb/serial/cp210x.c?h=v4.14.14.
 
That is just an example to find it in the path.

- For simplicity, I've just made a copy and pretended that it was a new 
kernel module and I've used information online for how to build the driver 
and load it to the running kernel.
This was the messy process and it's not fail proof for future kernel 
updates, but my focus was just to make it work. The goal was to have the 
weather station show up as /dev/ttyUSB0 for example. I'm not a kernel 
developer so I have to figure out how this process should be handled in a 
better way. There are instructions online on how to build an own kernel 
module but unfortunately not all of them are great.

- The driver has to be patched by adding usb_device_id for WMR89, as stated 
in the wxforum. Basically add a line with { USB_DEVICE(<vendor id>, <product 
id>) }, to the device id table in the driver file. I was also mentioned 
that maybe the non standard baud rate 128000 that is used, should be mapped 
to some other standard value. I haven't done that since it wasn't needed 
for pyserial, but maybe it is needed for other serial communication 
libraries.

- I had to load the usbserial module before loading the built module for 
WMR89. Use dmesg to look for error messages.
 

>
> my work thus far is here:
>
> https://github.com/matthewwall/weewx-wmr89
>
> this should be an easy one to add to the weewx core.
>
> m 
>

Reply via email to