[latency fix] Wifi driver auto load/unload

More
21 Jan 2013 07:59 - 21 Jan 2013 08:25 #28896 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!


File Attachment:

File Name: wifi_daemon.zip
File Size:2 KB
Attachments:
Last edit: 21 Jan 2013 08:25 by birchy. Reason: smelling pistakes

Please Log in or Create an account to join the conversation.

More
21 Jan 2013 09:10 #28901 by cmorley
Well now that was some smart thinking!

Please Log in or Create an account to join the conversation.

More
22 Jan 2013 05:24 #28933 by birchy

Well now that was some smart thinking!

I do love Python. It allows me to be lazy (or "smart" as you call it...). ;)

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds
Powered by Kunena Forum