I’m having issue working with USB client on a G400-D module. I tried the simple code below taken from the USB Client Documents.
My understanding of the USB client module as a Keyboard means the device should appear in my Keyboards list and I should not be able to debug it through Visual Studio so I added some simple LED to understand where it’s breaking.
After deploying to the board and reseting the device (reset button on the board) the result is:
LED1 is On
LED2 is Off
LED3 is blinking.
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware.UsbClient;
using Microsoft.SPOT.Hardware;
using GHI.Usb;
using GHI.Usb.Client;
public class Program
{
private static OutputPort LED1 = new Microsoft.SPOT.Hardware.OutputPort((Cpu.Pin)75, false);
private static OutputPort LED2 = new Microsoft.SPOT.Hardware.OutputPort((Cpu.Pin)76, false);
private static OutputPort LED3 = new Microsoft.SPOT.Hardware.OutputPort((Cpu.Pin)77, false);
private static OutputPort LED4 = new Microsoft.SPOT.Hardware.OutputPort((Cpu.Pin)78, false);
public static void Main()
{
Thread.Sleep(10000);
Keyboard kb = new Keyboard();
try
{Controller.ActiveDevice = kb;}
catch (Exception)
{LED1.Write(true);}
while (true)
{
try
{
if (Controller.State == UsbController.PortState.Running)
{
try
{
kb.Stroke(Key.W);
kb.Stroke(Key.O);
kb.Stroke(Key.R);
kb.Stroke(Key.L);
kb.Stroke(Key.D);
kb.Stroke(Key.Enter);
}
catch (Exception)
{LED3.Write(!LED3.Read());}
}
}
catch (Exception)
{LED2.Write(!LED2.Read());}
Thread.Sleep(1000);
}
}
}
Agreed, but check this online documentation https://www.ghielectronics.com/docs/20/usb-client Keyboard section and you’ll see the same code as in the G400 documentation plus this line.
And as far as I read on other post on this forum it should be there…
@ pidji87 - There was a problem with Keyboard that was supposed to be fixed, but GHI should be able to confirm if it was included in the latest firmware or not.
I just gave a shot to the code below with a Mouse this time. I do also get an extra Mouse HID in my devices but no movement and surprisingly LED3 is ON and not blinking
If I remember correctly, on G400, USBClient does only support CDC and USB Client MS.
Keyboard, mouse are not supported yet. Check release note, I think
Tried the CDC and it works, I can send data from the board to a terminal on my laptop.
Therefore regarding Keyboard (and mouse potentially) I looked at “NETMF v4.3 Release Notes” and in 2014 R3 you (GHI) mentioned :
All Boards
Changes
USB Client keyboards now behave properly.
In 2014 R4:
G400
Version
4.3.5.0 Firmware
4.3.5.0 Loader
Changes
…
Fixed a bug where USB Host and Client at the same time can freeze the board.
Fixed CDC failing to write after the first time.
Fixed CDC crashing the board.
Issues
…
USB Client Mass Storage may work incorrectly.
And in 2014 R5:
G400
Version
4.3.6.0 Firmware
4.3.6.0 Loader
Changes
…
Improved USB client stability.
So as far as we discuss here I’d say either something has been broken in latest releases or it has never worked on G400.
It’s a shame I’m having such issues because even if I’m new to your products I’m looking at using them in a V2 of my commercial product and I’m not feeling confident at deploying it to the market yet. G400 is your “professionnal” module, am I right? and I’m hoping for more stability or at least from a marketing point of view a clearer understanding of what’s available and what’s not on such module.
Anyway if you have any other inputs or Beta framework to test I’m willing to help.
Hi, 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?