Hi, I found that it’s not compatible with it. Does something changed? I tried my G400 as USB Client Keyboard without success. Does the G30 TH Module be used as USB Client Keyboard to send keys to a PC?
Thank you.
Hi, I found that it’s not compatible with it. Does something changed? I tried my G400 as USB Client Keyboard without success. Does the G30 TH Module be used as USB Client Keyboard to send keys to a PC?
Thank you.
well, I’ll respond in this one since you decided to double post including in a year old thread and then start your own
According to the task tracker, that was resolved in November 2014. What SDK are you using ? Have you updated the firmware? What troubleshooting have you done, what actually occurs, and what errors do you see?
Hi, I double posted when I see that post was 1 year old
I am using NETMF by GHI 4.3.7.10
I am using standard example that send to PC “Hello world!”.
I am blocked because when debugger arrive to:
It throw:
Il thread '<Nessun nome>' (0x2) è terminato con il codice 0 (0x0).
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### GHI.Usb.Client.RawDevice::NativeInitialize [IP: 0000] ####
#### GHI.Usb.Client.RawDevice::Activate [IP: 00fe] ####
#### GHI.Usb.Client.Controller::set_ActiveDevice [IP: 001c] ####
#### Program::Main [IP: 0009] ####
Eccezione first-chance di tipo 'System.InvalidOperationException' in GHI.Usb.dll
Eccezione non gestita di tipo 'System.InvalidOperationException' in GHI.Usb.dll
All the code is:
```cs
using System.Threading;
using GHI.Usb;
using GHI.Usb.Client;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware.UsbClient;
public class Program
{
public static void Main()
{
// Start keyboard
Keyboard kb = new Keyboard();
Controller.ActiveDevice = kb;
Debug.Print("Waiting to connect to PC...");
// Send "Hello world!" every second
while (true)
{
// Check if connected to PC
if (Controller.State ==
UsbController.PortState.Running)
{
// We need shift down for capital "H"
kb.Press(Key.LeftShift);
kb.Stroke(Key.H);
kb.Release(Key.LeftShift);
// Now "ello world"
kb.Stroke(Key.E);
kb.Stroke(Key.L);
kb.Stroke(Key.L);
kb.Stroke(Key.O);
kb.Stroke(Key.Space);
kb.Stroke(Key.W);
kb.Stroke(Key.O);
kb.Stroke(Key.R);
kb.Stroke(Key.L);
kb.Stroke(Key.D);
// The "!"
kb.Press(Key.LeftShift);
kb.Stroke(Key.D1);
kb.Release(Key.LeftShift);
// Send an enter key
kb.Stroke(Key.Enter);
}
Thread.Sleep(1000);
}
}
}
My bad I was using USB as Debug… I read that I need to use serial for debug! :wall:
I now get:
Il thread ‘’ (0x2) è terminato con il codice 0 (0x0).
Waiting to connect to PC…
#### Exception GHI.Usb.OperationTimedOutException - 0x00000000 (1) ####
#### Message:
#### GHI.Usb.Client.RawDevice+RawStream::Write [IP: 0093] ####
#### GHI.Usb.Client.RawDevice+RawStream::Write [IP: 0022] ####
#### GHI.Usb.Client.Keyboard::Press [IP: 006e] ####
#### GHI.Usb.Client.Keyboard::Stroke [IP: 0013] ####
#### Program::Main [IP: 0060] ####
Eccezione first-chance di tipo ‘GHI.Usb.OperationTimedOutException’ in GHI.Usb.dll
Eccezione non gestita di tipo ‘GHI.Usb.OperationTimedOutException’ in GHI.Usb.dll
at:
kb.Stroke(Key.Space);
but I’m not getting “Hello” printed before…
Ok that was a timeout… things has need of some time… I found useful this change:
public static void Main()
{
// Start keyboard
Keyboard kb = new Keyboard();
Controller.ActiveDevice = kb;
Debug.Print("Waiting to connect to PC...");
// Send "Hello world!" every second
while (true)
{
bool first_run = true;
// Check if connected to PC
if (Controller.State ==
UsbController.PortState.Running)
{
// We need shift down for capital "H"
if (first_run)
Thread.Sleep(500);
first_run = false;
kb.Press(Key.LeftShift);
kb.Stroke(Key.H);
kb.Release(Key.LeftShift);
// Now "ello world"
kb.Stroke(Key.E);
kb.Stroke(Key.L);
kb.Stroke(Key.L);
kb.Stroke(Key.O);
kb.Stroke(Key.Space);
kb.Stroke(Key.W);
kb.Stroke(Key.O);
kb.Stroke(Key.R);
kb.Stroke(Key.L);
kb.Stroke(Key.D);
// The "!"
kb.Press(Key.LeftShift);
kb.Stroke(Key.D1);
kb.Release(Key.LeftShift);
// Send an enter key
kb.Stroke(Key.Enter);
}
Thread.Sleep(1000);
}
}