Author Topic: Stroking keys via USB  (Read 24288 times)

hassanayoub85

  • Member
  • ***
  • Posts: 8
Stroking keys via USB
« on: October 19, 2012, 02:18:03 pm »
Hello experts,
Can i use your USB control for c# to give my PC keyboard strokes form .net application running ona tablet PC?Like by pressing a button on a tablet pc, it will send Ctrl+Esc to the PC.
Thx in advanced

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #1 on: October 19, 2012, 03:13:05 pm »

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #2 on: October 19, 2012, 03:31:20 pm »
Thx for it, but I know it.
This will work well if the keystrokes sender application is hosted on the same PC where the application which I want to apply the strokes on is.
While my scenario is different:
1- PC have an application running.
2- Tablet PC have the key strokes application running.
I want to press a button on the tablet PC which is connected through usb to the PC, then the main applicaiton on the PC will get this strokes (Shift+1, Ctrl+ESC) and act with it.
So simple, the tablet pc should be a keyboard for the normal PC.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #3 on: October 19, 2012, 04:09:27 pm »
To communicate with the PC, the tablet PC would need to have a USB device port so you can attach a USB cable.

You might look into sending the codes via a network interface, then use SendKeys to send the codes to an application.
« Last Edit: October 19, 2012, 04:32:57 pm by Jan Axelson »

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #4 on: October 19, 2012, 05:41:10 pm »
I see, and that's what I am searching for!!!
How can I send commands from tablet to ps through usb?
Dont i need a control like yours?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #5 on: October 19, 2012, 06:04:58 pm »
You can't do it directly unless your tablet PC has a USB device or OTG port. A device port has a series-B, mini-B, or micro-B connector. An OTG port has a mini-AB or micro-AB connector:

http://www.cablestogo.com/resources/usb.asp

You could use a PC/PC USB bridge cable to create a network connection between the PCs:

http://www.hardwaresecrets.com/article/Connecting-Two-PCs-Using-a-USB-USB-Cable/248

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #6 on: October 19, 2012, 06:09:30 pm »
So do u mean, I use the usb cable to make a network by tablet and pc, or even using normal network cable.
And then develop the application to send data as sockets like client server application, then I sendkeystrokes on the PC which are recieved by network (USB or lan) from the tablet?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #7 on: October 19, 2012, 09:01:18 pm »
Yes, that's the only way I can think of offhand to do it.

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #8 on: October 20, 2012, 05:02:10 am »
Ok i see.
So where is the usage of yur usb control?
Doesnt it work like serial control? so i can easly select the serial port and pass the key to it?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #9 on: October 20, 2012, 01:19:40 pm »
If you mean my USB HID example application, my HID page has example firmware with descriptors for a HID that sends and receives vendor-defined data.

http://www.lvr.com/hidpage.htm#MyExampleCode

A HID is not a USB virtual serial port device, which functions at the application level just like a physical serial port device: it can send and receive any type of data.

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #10 on: October 20, 2012, 02:49:38 pm »
So cant I use your control to hande the usb on bothe sides, and by then exchange data?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #11 on: October 20, 2012, 06:02:21 pm »
No, you would need the tablet PC to function as a HID device, and the tablet PC likely only has a USB host port.

A USB bridge cable creates a network connection.

Not to confuse the issue, but you can also use two USB/serial adapters with a null modem adapter in between. Then the two PCs can communicate over virtual COM ports.

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #12 on: October 21, 2012, 03:31:35 pm »
I see.
Thx alot for your cooperation and help, u r really an expert.
Just last thing.
So where is the usage of your USb control?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Stroking keys via USB
« Reply #13 on: October 21, 2012, 04:32:55 pm »
My HID page has example firmware with descriptors for a HID that sends and receives vendor-defined data.

http://www.lvr.com/hidpage.htm#MyExampleCode

Devices that use this firmware can communicate with my example PC generic HID application, as can other HIDs except system keyboards and mice.

hassanayoub85

  • Member
  • ***
  • Posts: 8
Re: Stroking keys via USB
« Reply #14 on: October 21, 2012, 04:46:31 pm »
mmm, it's ok.
Thx alot