Device Enable/Disable script - scripting

I have Windows 7 64 Bit Professional Edition on a computer I built myself so there is no manufacturer to ask. I am using an on-board sound card which has 7.1 and Optical outputs. The optical output is plugged into a Denon amp which controls the speakers.
I have got a speaker system plugged into my computer through the optical port on my sound card. When I use standard windows drivers I only get stereo output so I installed the Realtek HD audio driver. This gives me surround sound successfully however it does not tie this as a standard speaker so when I plug in headphones and define them as headphones nothing happens the audio still goes to the speaker system and nothing to the headphones.
I have discovered that if I disable the Digital output device in the playback devices list the audio is automatically rerouted through the headphones. Therefore I have been trying to find a way of disabling or enabling this device. I have a programmable keyboard so I can map a program or script to a spare key therefore I am trying to write a program to check if the device is enabled or disabled then change this to whatever it is not i.e. if on turn off and if off turn on.
I attempted to locate the hardware IDs which are1. "HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_105BA601"2. "HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_105BA601&REV_1000"
I had planned to create a batch script using devcon (the command line alternative to device manager.) using the below code to disable or enable the device
devcon disable "HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_105BA601*"devcon enable "HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_105BA601*"
However devcon fails to disable these devices as the optical connection is on the sound card and I can only disable the entire sound card which would also disable the headphones.
I am a little lost as to what to do now and I really don't want my brother to need to play with disabling devices.
I am open to any suggestions. I am happy to use any language to do this. Im sure there must be a way of doing this from c but I have been unable to locate any information on this. I would appreciate any suggestions. I am quite happy to write the program myself but if someone could at least point me in the right direction to an api or something like devcon or some way in some language to do this. I currently know VB6, VB.NET, VB Script, Java and Batch Scripting and Powershell quite well and have some knowledge of C, C++ and C#.NET.
any and all help would be appreciated
Kind RegardsDexter

You can try with this :
devcon /r disable #"HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_105BA601*"
devcon /r enable #"HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_105BA601*"
Regards,
Pal

Related

Where are my USB mouse's files stored and how to reverse-engineer them?

I bought a new mouse (which doesn't have it's own software) and I was wondering:
Since it has RGB lights that change on their own, as far as my understanding goes, it has some software inside it that controls this.
First, the simpler question: when I first connect the mouse, Windows says it's "installing" some stuff. Where can I find this stuff (files probably)?
Second: Is there any way for me to "reverse engineer" this and get access to the mouse's code, so that I would be able to control the LED's color, for example?
When Windows says it is "installing" something for your mouse, it is looking at the USB descriptors, figuring out what driver to associate with the mouse, and recording other metadata. You can look in your registry under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB" to see what gets recorded. For a more complicated device, I think Windows could actually download driver files from the internet during this stage and install them on your computer. But for a standard HID mouse, it should already have the drivers it needs.
There is no standard way to read the code from a hardware device, and it is likely to be extremely difficult if the device is not open source. The code is likely stored in the memory of a microcontroller that has read protection enabled, meaning that it cannot be read from an external programmer. It is also possible that much of the funcitonality of the mouse is actually implemented in application-specific hardware instead of software.
If there is existing software on your PC that allows you to control the LED color of your mouse, your best hope is to run that software and look at what USB packets it is sending to the mouse using a USB protocol analyzer.

How to program the microcontroller?

I have a microcontroller STM32F051 and I want to program it. I looked for IDE that I would be able to use and I found TRUESTUDIO that I'm using. I wanted to know how should I do to send the program I made into the microcontroller. Do I need any specific programmer (like an electronic device for Microchip Pics) ? When I clic the button debug, I get an error
"Error in initializing ST-Link device. Reason: Failed to connect to device. Please check power and cabling to target."
I'm not sure if I misunderstood something. I download the software and I selected my specific version of microcontroller, but it seems that it doesn't recognize it...
Yes, no matter what the mcu you will need some interface, be it as simple as a usb connector tied to the chip, or a debug header using some other device or electronics. For an stm32 chip many of the discovery boards and the nucleo boards (in particular the ones with a breakaway end, you dont have to break it off, just remove some jumpers to use it on other devices (not necessarily ST devices)). These parts also have a serial bootloader inside that you cant change so it is always there, and can sometimes use one of the nucleo stlink debuggers (do some research as to ones that offer a virtual uart, not all of them do, cheaper than the dedicated stlink dongles) or say an ftdi usb breakout board (under $2 on ebay).
There are numerous options for programming these parts as in writing software, can just use gnu tools and roll your own drivers (pretty easy the documentation is pretty good), get one of the ST libraries that they offer (for free) or if you have a Nucleo you might be able to use mbed or arduino to develop.
We really need to know more about the board you have this part on, is it just a breakout board or as asked in the comments did you buy a nucleo board or a discovery board? Are you running linux, windows or mac or other or are flexible on what host?

Windows Embedded USB Client options

I am a very novice embedded developer and I am trying to develop a commercial product using Windows Embedded Compact and a Toradex Apalis T30 COM. Firstly just excuse me here, I am not a professional nor a trained engineer, merely a hobbyist trying to push the boundaries so forgive me if this is supposed to be trivial. I should also state that because of this I have no low level USB experience. I would like to use WEC 2013 but Toradex does not quite have it ready yet so for I guess at least another month I am stuck on WEC 7 if that makes any difference.
My problem is that I cannot seem to figure how one goes implementing USB Client functionality in WEC. As in, I want my device to be able to connect to my PC as a USB client with the PC being the host. Now by default it connects with the Active Sync (now Device Center or something) application and that allows serial communication of sorts if I am not mistaken but I really don't want to make my device dependent on ActiveSync as that will leave a very bad impression on customers as it doesn't look very professional and bears to much of an association with yesteryear's Windows Mobile.
My device is a 3D printer and I am assuming that there is no native USB class for 3D printers. All 3D printers I know of merely use a USB COM port to communicate and I guess that that should be fine for me two. Now what I want to know is how I can make my device appear as a plug and play USB COM port (able to support all the major desktop operating systems)? I know I can use an FTDI chip to do this with a UART port on my device but I am thinking that that is a bit of a waste given the fact that my COM has a built-in USB client port.
One would think that WEC would have built-in support for something like this but I cannot find any documentation regarding how to use it if it does indeed exist. The best I can find is http://msdn.microsoft.com/en-us/library/ee481935.aspx but the page does not really say anything useful.
PS. I cannot really afford to buy a USB vendor-id so I am hoping there is a solution to this that does not require one.
For windows embedded, you have to manually write a driver or a set of registry entries with the right Device Class ID, Vendor ID and Product ID. Once that is done, you need to integrate it in Windows Embedded and rebuild the solution.

spartan 6 - usb keyboard

I'm attempting to use a usb keyboard to control a game I built on a spartan 6 board. I'm struggling to understand the process to get this to work though.
I see the physical usb port on the board (I'm using a xilinx university board on campus). I understand there are AXI IP's for usb2, but they all require a license (and won't let me export the project to sdk if I use them).
I came across the open usb source at http://jorisvr.nl/usb/. I'm thinking this is exactly what I want/need, but I'm struggling to understand how to implement it.
Right now I think I should use xilinx platform studio to create a custom ip. Within that custom ip make use of the vhdl source for open usb. The process of hooking up all the different ports has me at a loss. But the thing I don't understand the most is the PHY (UTMI) block that's required for the open usb to even work. What is that? Do I need to implement it?
I'm a bit lost. Any guidance would be appreciated. The manual for open usb can be found http://jorisvr.nl/files/fpga_usb_serial_manual.pdf.

Turn on PC with USB-device

I want to be able to turn my PC on and off using an IR-remote sensor that is connected via USB to the PC. The sensor is a custom PCB implemented with an AVR microprocessor and V-USB software USB-implementation.
Now, turning off the PC is no problem with software, but is there any way to turn ON the PC using USB?
(Please note, I'm not talking about booting from USB-stick or USB-power supply ...)
There seem to be two problems:
keeping the USB powered on while the PC is off. It seems that most mainboard have a jumper for this functionality.
bringing the PC back to life. There seems to be no standard functionality for this. The solution is to "press" the PCs power button through the AVR on the USB board. I know, this means extra cable from the USB to the PC, but it seems to be the easiest solution.
Another workaround could be to send the power-on signal to the PC over ethernet. But I guess this will be more complicated than the power button solution and it involves extra cables too.
This Microsoft knowledgebase article describes how to enable "wake on USB" for a USB mouse. I just checked, and my keyboard device entry (on Windows Vista) has the same choice, already checked.
So, if your AVR is emulating a USB keyboard or mouse, it should be possible to wake the computer by sending the proper data.
there must be a way to do this with USB, since some PCs can be switched on with the keyboard. I think this will be some looking whether your mainboard/BIOS support it (it may be you need to turn it on in BIOS, this will probably also ensure your device gets power from USB although the PC is switched off), and whether that V-USB (unknown to me) can send the "wakeup"-signal.
good luck !
How "off" does the PC need to be? Is waking from sleep/suspend enough? The USB standard describes "remote wake-up".
Aside from enabling remote-wakeup, like unwind mentions, software on the PC is not involved in making this work.