I had replaced my M2 controller a few months after getting the K40 up and running so have not tried this but when someone does, please post status here and if you find a bug, please post an issue at the liblasercut repo so it can be updated. Thomas is very willing to keep liblasercut working so feedback is very helpful to everyone.
Thank you @dougl, like you I switch board, but I am a Visicut fan, since it was that software make me mod my K40 many years ago.
It is so awesome to see the great options for control of the K40 that have come about in past few years.
The new New to K40: Start Here document lists VisiCut supporting M2Nano and gcode, and hopefully soon we can add it to the Ruida list too.