PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Anyone know of this program?

Anyone know of a tiny little program that will activate a WiFi card when run and deactivate it when run? Like a little command line program that could run for a split second in the background? Like "wifi.exe -activate" and "wifi.exe -deactivate" ?
Never heard of it, but I'd love something that did that for activating and deactivating the LAN and Wifi connections instead of going into control panel->network connections and disabling/enabling the seperate connections.
devcon is the way to go.

Do this:

devcon hwids * > hwids.txt

Then look in the txt file for the device you want to turn on/off and find the hwid listing.

E.g. for my d-link card its entry is:

PCI\VEN_1186&DEV;_4C00&SUBSYS;_4C001186&REV;_11\4&11C9F252&0&08F0
Name: D-Link DGE-530T Gigabit Ethernet Adapter
Hardware ID's:
PCI\VEN_1186&DEV;_4C00&SUBSYS;_4C001186&REV;_11
PCI\VEN_1186&DEV;_4C00&SUBSYS;_4C001186
PCI\VEN_1186&DEV;_4C00&CC;_020000
PCI\VEN_1186&DEV;_4C00&CC;_0200
Compatible ID's:
PCI\VEN_1186&DEV;_4C00&REV;_11
PCI\VEN_1186&DEV;_4C00
PCI\VEN_1186&CC;_020000
PCI\VEN_1186&CC;_0200
PCI\VEN_1186
PCI\CC_020000
PCI\CC_0200


So to disable and enable it:

devcon disable "PCI\VEN_1186&DEV;_4C00&SUBSYS;_4C001186&REV;_11"

devcon enable "PCI\VEN_1186&DEV;_4C00&SUBSYS;_4C001186&REV;_11"
Yup, that's exactly what I was looking for, but now I have what I want to happen set up a little clumsily.

I want my computer to automatically disable my WiFi card if my computer starts up in battery mode, but if my computer starts up plugged in and docked I want WiFi enabled. Right now I'm trying to use Windows's Task Scheduler to do this and I have it automatically disable the wifi using devcon at system start up and then if it detects A/C power to reenable it. Is there a better way to do this? Maybe a batch or COM file that I can if-then? Basically, I want devcon status *APCI0003 to return to me a positive or negative value, and depending upon that value to either devcon enable/disable PCI*...WiFi*[/code]
EDIT!

I figured out the batch file, I'll post it after I double check that it works right. BRB

Nope, nevermind, didn't work. I was hoping the device driver for the A/C supplier would deactivate when not plugged in, but it doesn't, so my approach didn't do it.

In need of ideas.
Why would you only want to use wifi when it's plugged in the wall? Isn't the purpose of wifi to be... wireless?
I want it to be automatically turned on when the computer starts up in A/C mode, but automatically off when turned to battery mode because battery life is important and because I use wireless when docked. If I'm docked and take it out I still want the WiFi running, but by default I want it off when I start my computer in battery mode because most of the places I use my TabletPC on battery is in class when I don't need WiFi to be running and I do need battery life.

Microsoft needs to make seperate docked and undocked hardware profiles and system settings, that would be nice.
So basically, I need some way to check the power source that the computer is using. Anyone, any ideas?
Mike Wagstaff · 13 Nov 2005, 20:24 UTC
Yes. Can someone compile me a little program that shoots out errorlevel codes at runtime termination that indicates battery power or A/C power? I don't have a compiler, I'm sure it would only take someone about 5 minutes to do. And then if you could post it here I'll post my BAT script and we'll have a nice little setup.

Or if you feel like making it into one nice little program that will activate WiFi when A/C mode is detected and deactivate when battery mode is detected I wouldn't stop you. Then my silly BAT wouldn't be needed.
Okay, this is what I did. I checked using devcon to see if my mouse was connected. If not I assumed battery mode, if so I assumed it was docked. It checks for an error level of 1 or greater which indicates that the device is not installed among other things. If it receives an error level of 0 then it means the device is running perfectly.

WIFI.BAT, run at logon using Task Scheduler
Code:
@ECHO OFF
ECHO.

SETLOCAL
DEVCON status "HID\VID_045E&PID;_001E"
IF ERRORLEVEL 1 (
ECHO Running on Battery, Disabling WiFi
DEVCON DISABLE"PCI\VEN_8086&DEV;_1043&SUBSYS;_25278086&REV;_04"
) ELSE (
ECHO Running on A/C, Enabling WiFi
DEVCON ENABLE "PCI\VEN_8086&DEV;_1043&SUBSYS;_25278086&REV;_04"

)
ENDLOCAL


Or Dan has posted a small little program that returns some nifty error codes. Check here:
http://www.pocketmatrix.com/forums/view ... 935#267935
Doesnt your Tablet have some sort of power management tool with it? My sony has it, and it allows me to set up all kinds of things (brightness when [un]docket, what devices are enabled and what not, etc.). Also, I thought most laptops/tablets nowadays have an external WiFi switch?
mine did not.
Oh ok, weird. Maybe it's an additional download or something? Anyway, since you already got it to work, it doesn't matter anymore :).