View Full Version : Keyboard and Mouse over network (TCP/IP), for example via Synergy
i just noticed this really cool source forge project that lets you share a keyboard/mouse with a 2nd computer. it would be cool to add this ability to xbmc and maybe other xbox apps where you could have keyboard/mouse access on the xbox without having to buy extra hardware.
http://synergy2.sourceforge.net/about.html
deep square leg
2004-09-01, 03:45
just posting to agree.
we use synergy here in my office, we've all got two (or three) different computers (pcs, macs, *nix) for testing purposes. since discovering synergy it has made our life that much easier, and it works over ethernet.
as soon as we started using it i thought 'this would be incredibly handy for the xbox!' i could use it if i was running linux on my xbox, but all i ever run is xbmc.
hi all!!
i'm testing x-link kai featured in xbmc, and i'm seeing a chat room. using the virtual keyboard, or the mobile phone-style from the remote controller, is a little slow for a chat session. wouldn't be nice to implement something like a server on xbmc, that listens over tcp/ip to a pc, to be able to use the pc keyboard for entering text (also aplicable for navigating through menus).
it would be something like a pc app (the client) that captures the keyboard, and then the xbmc server, that listens to the pc, receives the keys that you've pressed on the keyboard (in ascii code, for example), and emulates them on xbmc.
is it possible? i think that would be nice ;)
thanks! :)
pd: sorry for my bad english. i'm from spain :p
i am posting to bring this topic back to life. i too have recently used synergy and it works great. it would be great if the synergy client could be incorporated into xbmc. there are features within xbmc that i dont use often mainly because of needing to type stuff and i am too lazy to break out a keyboard and hook it up to my pso adapter. is there any possibility for this to be a feature of xbmc? i would think that only the client would need to be implemented and the settings for that could easily be within the settings section and would only need to specify a host ip or perhaps changing the hostname of the xbox so the synergy server can recognize it easier.
here is a link to the sourceforge page: http://synergy2.sourceforge.net/
any other comments?
don't know if already posted, but perhaps it would be useful if one could use the keyboard and mouse at a networked pc as if they where directly connected to the xbox.
this can be done trough python scripting now.
maby it's allready made?
anyway the httpapi commands exposes keyboard and mouse events.
a while ago i tried for a while to get those mouse events to work but didnt have much luck. if the httpapi does work doing this should be easy in either javascript or java.
ok i did a little more digging and i was able to get the keyboard to work halfway.
for a keyboard you need the normal
http://xboxip/xbmccmds/xbmchttp?command=sendkey¶meter=xx
where xx is the decimal number 61440 (xf000 in decimal) + vk code in decimal
where you can find the vk code at http://delphi.about.com/od/objectpascalide/l/blvkc.htm
remember it is decimal!
xx can also be 61696 (xf100) + ascii value of character
the problem lies in that no httpapi commands work through the webserver at all with a python keyboard up! for some reason they work with the builtin keyboard but not if it was run from python! grrr... i might work up a java or python or javascript app to do this depending on how my investigations go.
edit2: the cursor does seem to work (again not with python keyboard) however it is very difficult to use since it is invisible :/ when you move it with a real mouse it becomes visible for a while. also i'm not sure yet about the mouse wheel stuff.... the documentation is kinda light but i can step through the c++.
Loto_Bak
2006-01-14, 06:27
interesting, i might use this myself. i have a wireless keyboard/mouse that are incompatable with the xbox. this is functional throughout the entire xbmc program?
nice work
keep it up
loto
the keyboard seems more doable than the mouse right now. there are issues with python windows now.
this is my current code and it already is good enough for doing chat. you need to have python on your computer to use this. if i ever do a real app this would probably be java.
#!/usr/bin/python
import socket,threading,urllib,time, sys
import curses
xbox_ip = '192.168.xxx.xxx' # replace these!!!!
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
def subthreadprocstarter(url,port):
subthread = threading.thread(target=subthreadproc, args=(url,port))
subthread.setdaemon(true)
subthread.start()
subthread.join(1.0)
def subthreadproc(url,port):
try:
newurl = url+str(0xf100+port)
urllib.urlopen(newurl).close()
except:
pass
url = 'http://'+xbox_ip+'/xbmccmds/xbmchttp?command=sendkey¶meter='
mapping = {263:0x108,10:0x0d,339:0x21,338:0x22,360:0x23,262: 0x24,260:0x25,259:0x26,261:0x27,258:0x28,331:0x2d, 330:0x2e}
while 1:
try:
c = stdscr.getch()
if c == -1:
curses.nocbreak()
stdscr.keypad(0)
curses.echo()
curses.endwin()
break
if mapping.has_key(c):
# print c
c = mapping[c] -0x100
if c <= 255:
# print c
subthreadprocstarter(url,c)
# enter character and enter command are different?
if c == 13-256:
subthreadprocstarter(url,10)
# escape character and escape command are different?
if c == 27:
subthreadprocstarter(url,27-256)
except: pass
tjcortez
2007-05-24, 08:21
Posting to maybe bring it back to life again! This seems like it would be such a useful feature...I mean i'td be like using the xbox with no controller. Especially for media center purposes, like navigating menus. I know a dirty backend way can be to just send the http request using the web interface to send any key, but native synergy support would be cool. PLUS, synergy is written in C++.
If any of you devs have looked into this at all yet, any reason why no one is pursuing it?
TheBoxMan
2008-03-26, 16:59
Hey folks,
Just a thought I had. In the places where a keyboard is used in XBMC it would be handy to be able to use a propper keyboard without the need for the rewiring game to make one fit the controller slot.
Could we have a windows machine forward keystrokes to XBMC?
I'm invisaging some kind of program run on the PC - possibly sitting in the background and starting with a keyboard shortcut.
Which will then forward all keystrokes to XBMC over the network.
Probably stopped by another shortcut.
This would be pretty much a complete fix for those of us with wireless keyboards :-D
Can it be done?
Is it possible?
How much work would implimenting it be?
Thanks for your help guys. I only wish I had hte skills to do this.
yes, just write an even client
Gamester17
2008-03-26, 18:07
FYI; "event server" is a new way to control XBMC (locally or remote), you can write an "event client" for almost any input-device in any progamming-language, see:
https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC/tools/EventClients/
As my number of XBMC for XXXX testing systems increases, I find the issue has become not switching the video output to the display device but dealing with keyboard and mouse. A KVM switch only works so well and for my HDTV with 2 component, 4 HDMI, it's useless.
Has anyone written a simple EventClient that just does a tcp/ip transport of keyboard/mouse. Or has a good solution that has minimal impact on the test system that does not involve installing VNC on test boxes.
jmarshall
2008-09-08, 23:39
http://synergy2.sourceforge.net/ perhaps?
If it's ok to have a window attached to it I could create a really fast one in SDL?
Otherwise I reckon it should be doable via some linux internal, read the /dev/ I guess.
Gamester17
2008-09-08, 23:56
http://synergy2.sourceforge.net/ perhaps?Sounds great, ... and has also been suggested before http://xbmc.org/forum/showthread.php?t=5545
I saw the Synergy ref and the python one, I'll have to give these a try. I've sure other devs would be interested in a simple low impact way to do this. Don't really need mouse, just keyboard. Come to think of it, there was a command-line app I just a year or so that could send keyboard events to MythTV. I also need to dig this up and see if I can re-purpose it for XBMC usage.
Put in XBMCSVN/tools/EventClients/Clients/Foo/bar.cpp
http://pastebin.com/m22112676
compile with g++ -lSDL bar.cpp
Should start a window and send any keyboard command from that one to XBMC, not a super pretty solution but a quick one for you now :)
(run with ./a.out IP PORT by default these are localhost and 9777)
Put in XBMCSVN/tools/EventClients/Clients/Foo/bar.cpp
http://pastebin.com/m22112676
compile with g++ -lSDL bar.cpp
Should start a window and send any keyboard command from that one to XBMC, not a super pretty solution but a quick one for you now :)
(run with ./a.out IP PORT by default these are localhost and 9777)
Nice, you the man ;) First thing I try when I get home from work.
Nice, you the man ;) First thing I try when I get home from work.
Thanks Topfs2, this works like a champ. I had to futz a bit to get it to build on OSX but not a problem.
Nice work topfs2 :-) quite a useful utility IMHO.
Gamester17
2008-09-10, 10:33
Feature request for Synergy submitted on trac: http://xbmc.org/trac/ticket/4843
:grin:
shanedoyle
2008-09-24, 09:52
If im not compiling from SVN is there anyway of getting synergy working with XBMC - I have the most recent build and have synergy on my kubuntu laptop??
This looks really promising
S
Hello,
I'm using synergy2 (http://synergy2.sourceforge.net/)to control my htpc through my main computer. Everything works just fine besides when i fullscreen XBMC the mouse becomes a issue. It's hardly controllable but if you really move the mouse slowly you can barly control it. It's like its gliding on ice or something, and the sensitivity is insane! The keyboard works fine.
If i use windowed mode there is no issues with mouse.
I didn't find much information regarding this, all i found is this:
http://xbmc.org/trac/ticket/4843
Thanks for the support!
shanedoyle
2008-10-02, 08:18
Before i spend another couple of hours on this - those of you that have this working is it working on the XBOX platform or XBMC for linux.. I love the idea of this but having spent a bit of time trying to get it to work want to make sure im not flogging a dead horse..
Thanks
Shane
Empire666
2009-10-05, 03:06
I MADE IT
ok i did a little more digging and i was able to get the keyboard to work halfway.
for a keyboard you need the normal
http://xboxip/xbmccmds/xbmchttp?command=sendkey¶meter=xx
where xx is the decimal number 61440 (xf000 in decimal) + vk code in decimal
where you can find the vk code at http://delphi.about.com/od/objectpascalide/l/blvkc.htm
remember it is decimal!
xx can also be 61696 (xf100) + ascii value of character
the problem lies in that no httpapi commands work through the webserver at all with a python keyboard up! for some reason they work with the builtin keyboard but not if it was run from python! grrr... i might work up a java or python or javascript app to do this depending on how my investigations go.
edit2: the cursor does seem to work (again not with python keyboard) however it is very difficult to use since it is invisible :/ when you move it with a real mouse it becomes visible for a while. also i'm not sure yet about the mouse wheel stuff.... the documentation is kinda light but i can step through the c++.
ok so after trolling all of google trying to find some kind of solution to add a virtual keyboard to the xbox i came up with completely nothing
ok so thanks to Asteron on telling us that we cound send keys to the xbox via http
and also the link http://delphi.about.com/od/objectpascalide/l/blvkc.htm
i made a java virtual keyboard that captures your keystrokes encodes them in hex and sends them to the xbox with a inputstreamreader
its works pretty well but keep in mind that what i made is still like pre alpa beta and i still have to work out a bunch of the bugs and key mapping but for the over all pourpose it works
to run it ull need java and a command prompt
basically in ur cmd, bash shell, or w/e just type
java xboxvk
more to come when i finish all the keymapping and other functions
key map so far
a-z = a-z
A-Z = A-Z
0-9 = 0-9
Pg up = vol up
Pg dn = vol down
home = switch between display (tab)
enter = select
esc = esc/menu
backspace = backspace
up = up
down = down
left = left
right = right
still trying to get working as if u had a physical keyboard connected via usb
enjoy
http://depositfiles.com/files/zmi3wp2nc
oh yea extract it and change directory to in in ur terminal then run "java xboxvk"
to stop running it go back to the terminal and hit "crtl c"
Empire666
2009-10-05, 03:09
oh yea one more thing make sure u have the webserver enabled on your xbox so it can send it commands through its httpapi, at least i think u need to have the webserver enabled to use the httpapi
also this should work on all xbmc's
[QUOTE=Empire666;413448]
still trying to get working as if u had a physical keyboard connected via usb
/QUOTE]
Nice work!
I made a smallish SDL based virtual keyboard a while back which uses the eventserver.
So I'd suggest you to look into the EventServer because it's alot less overhead than the httpapi and should feel near instant on a normal lan, not as httpapi which actually takes a while on a lan.
Cheers,
Tobias.
one already exists, see http://code.google.com/p/atv-xbmc-launcher/source/browse/#svn/branches/temp/xbmc_remote
Empire666
2009-10-26, 04:23
ok heres the updated version of my java virtual keyboard
im also including the source code so if anyone wanted to make their own changes
also because i dont know how often ill be updating this thing or improving on it
key mapping
a-z = a-z
A-Z = A-Z
0-9 = 0-9
Pg up = vol up
Pg dn = vol down
home = switch between display (tab)
insert = title
delete = info
super/windows key = play pause menu
context menu = context menu
enter = select
esc = back
shift + esc = esc/menu
backspace = backspace
up = up
down = down
left = left
right = right
http://depositfiles.com/files/0zhmitsoe