[latency fix] Wifi driver auto load/unload
21 Jan 2013 07:59 - 21 Jan 2013 08:25 #28896
by birchy
[latency fix] Wifi driver auto load/unload was created by birchy
While setting up my first LinuxCNC computer, it was apparent that the wifi card was wreaking havoc with my latency tests. After carrying out the standard procedures to improve latency such as disabling power management, unused services, etc, my latency was around the 31K mark. With the PCI wifi card removed, latency was a more acceptable 18K.
Although having an internet connection on the CNC machine is not essential, I require it in order to carry out updates, install software, have occasional access to this forum and more importantly, be able to upload gcode files from my desktop machine using SSH. Running an ethernet cable to my CNC machine was not really an option due to the machine location, so I experimented with leaving the wifi card plugged into the PCI slot, but enabling/disabling the driver to switch it on/off. With the wifi driver disabled, I am able to maintain latency around 18K, and with it enabled, around 31K.
So I wrote a Python script to automatically enable/disable the wifi driver depending on whether or not LinuxCNC is running. Basically, if either Axis or the Latency Test are running, the wifi driver is unloaded. If neither of those processes are running, the driver is re-loaded. Network Manager will automatically connect/reconnect depending on the driver status, so we will have an internet connection if, and ONLY if, neither Axis or Latency Test are running.
The script currently loads/unloads the ndiswrapper driver as that is what my computer uses, however you can easily change the driver name to suit your own set up. Details on how to do this are in the script comments.
Hopefully others will find this solution as useful as I have!
Although having an internet connection on the CNC machine is not essential, I require it in order to carry out updates, install software, have occasional access to this forum and more importantly, be able to upload gcode files from my desktop machine using SSH. Running an ethernet cable to my CNC machine was not really an option due to the machine location, so I experimented with leaving the wifi card plugged into the PCI slot, but enabling/disabling the driver to switch it on/off. With the wifi driver disabled, I am able to maintain latency around 18K, and with it enabled, around 31K.
So I wrote a Python script to automatically enable/disable the wifi driver depending on whether or not LinuxCNC is running. Basically, if either Axis or the Latency Test are running, the wifi driver is unloaded. If neither of those processes are running, the driver is re-loaded. Network Manager will automatically connect/reconnect depending on the driver status, so we will have an internet connection if, and ONLY if, neither Axis or Latency Test are running.
The script currently loads/unloads the ndiswrapper driver as that is what my computer uses, however you can easily change the driver name to suit your own set up. Details on how to do this are in the script comments.
Hopefully others will find this solution as useful as I have!
Last edit: 21 Jan 2013 08:25 by birchy. Reason: smelling pistakes
Please Log in or Create an account to join the conversation.
21 Jan 2013 09:10 #28901
by cmorley
Replied by cmorley on topic [latency fix] Wifi driver auto load/unload
Well now that was some smart thinking!
Please Log in or Create an account to join the conversation.
22 Jan 2013 05:24 #28933
by birchy
Replied by birchy on topic [latency fix] Wifi driver auto load/unload
I do love Python. It allows me to be lazy (or "smart" as you call it...).Well now that was some smart thinking!
Please Log in or Create an account to join the conversation.
Time to create page: 0.132 seconds