New member questions

GromitD90

New member
Good day,

This is my first post on this forum. It was only a day ago when I came across the Teensy USB development site as I was searching for information on USB devices. If it is OK I would like to ask what are probably fairly simple questions to determine if I want to dip my toes into the water.

First of all let me describe my Use Case. I have a number of mini computers (typically Zotac CI3xx, and Azulle Byte 3's) which I use as (Home Theatre PC) HTPC devices attached to HDTV's. I have these installed in my home and in other members of my family's homes. We use them for all of our video streaming needs, both domestic and internationally via VPN's. The setup has been pretty stable over the last couple of years and I have developed programs that hide all of the underlying network configurations switches from the user. The one draw back with the setup was the way in which people tend to interact with it from a power off perspective. We have had cases where people have just turned off the TV and assumed that everything else would also switch off, which is not the case. A number of streaming sites have options that they will automatically start streaming the next episode in a series when the current one finishes. So what I have been searching for is a way for the PC to detect that the monitor, in this case the TV, had been turned off, so I could programatically stop any active streaming processes and put the PC into sleep mode.

I thought this would be easy, but after weeks of searching for a solution and writing all sorts of test programs to monitor what was going on. I could find no way to know that the TV had been turned off. The problem being that unless you completely disconnect the TV from the power source it is in a sleep mode and the PC still thinks it is turned on. I eventually found a solution using a device and software from a company in the UK called Pulse Eight. They make an adapter that is plugged into the HDMI output of the PC and passes the HDMI signals through to the TV. The device is also attached to a USB port on the PC (I had to mention USB sooner or later :D). The device communicates with the PC and the TV via the CEC line in the HDMI cable. Using this I was able to develop code that would turn on the TV and set the TV's input source to the correct port for the PC and when the user was done and switched off the TV, the TV would send out a standby command to any CEC compliant devices attached to it. This solved my problem, or so I thought, until I went to install it at my daughter's home. Turns out her TV doesn't support CEC so the device was useless in her case.

I put the problem on the back burner for a while but it was still nagging away at me so a couple of weeks ago I started trying to come up with a solution for a non-CEC setup. This time my solution was as follows:

While initially researching possible solutions I had bought myself a power strip from a company called Tickle Star. This power strip was aimed to solve the problem by having power outlets that were switched on or off when a control device, in this case the TV, went into a low power state. Their product literature showed devices such as soundbars, dvd players etc connected to the switched outlets. However, disconnecting the power to the PC via one of these outlets was a drastic solution to my problem. Instead what I did was to take an old USB 2.0 externally powered hub device and plugged it into one of the switched outlets. The external power supply was optional with the hub as it would also take power from the PC USB port, so I modified the setup so that the PC supplied +5V line was disconnected and the external power supply was needed. The end result was that when the TV was powered on the PC would have a new USB device attached and when it was powered off the device would be removed from the USB device list on the PC. So I wrote a program that runs in the background that captures device change events and determines if it was the USB hub that was attached or detached and act accordingly.
It works !!

However, and I'm sorry to be so long winded.

The routines I wrote have to be changed for each PC because their USB structures are different. When I connect the modified USB hub to the PC it is detected as a "Generic USB Hub" (that's what you see in the Device Manager). Some PC's already have a device with the same description attached so I have to do additional work to determine the location (Port # and Hub #) to differentiate the devices. Also the solution does not support a feature that I would like, namely to allow the PC to be woken up when the USB device is attached (i.e. the TV is powered on). For other reasons I would like to know if the PC was already awake when the USB device was powered on.

So now the scene is set - this is what I would like to do and wondered it was possible using one of the Teensy boards.

I would like to develop a USB device that behaved as follows:

1. Must be externally powered. So I would have to disable the +5V from the PC at the USB connector
2. Can be programmed to supply a unique attribute (e.g., description, vendor etc) to the PC that can be detected on the PC.
3. Be treated by the PC as a device type that is allowed to wake the computer (I was thinking a mouse device).
4. Can be programmed to detect if the PC is asleep or awake and if asleep send appropriate signals to the PC signifying mouse movement to wake the PC.

Number 4 is a nice to have. I was thinking that if the +5V connection on the board's USB connector was cut so it was not supplying power to the board, would it still be possible to detect if there was a +5V potential coming from the PC. Obviously this would require that the PC does not supply power to the USB ports when it is in sleep mode which I'm not sure if it does or not. I suspect it does supply power or how would non self powered devices be able to wake the computer?

Again, apologies for being so long winded and thanks in advance for any guidance with this project.

Mike
 
Thank you for the feedback. Can you confirm that I can meet my second requirement:

2. Can be programmed to supply a unique attribute (e.g., description, vendor etc) to the PC that can be detected on the PC.

And if so can you point me to an example where that has been coded.

Regards
Mike
 
I use tycommander to detect my teensy boards. It has the ability to detect the teensy serial number regardless of what port it’s in. tycommander can output json format of board details so you can easily adapt to your coding preference on the pc.
 
Back
Top