finally I completed the first version of USBHOTKEY, a small utility that allows you to implement a script similar to autohotkey, just under Linux/X11.
Check out
In case of any problems, contact me via email.
May you find this helpful,
--
Lars Krueger
http://LarsKrueger.homestead.com/files
mailto:lars_e_...@gmx.de
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
Looks good, Lars, I'm excited about working with it. Unfortunately I
haven't had a lot of success compiling software. It rarely works for
me. I got the SVN sources for libhid and it configured but failed
miserably to compile. I can't find an RPM for it. Any idea why I might
get stuff like this? Thanks.
hid_wrap.c:2642: error: conflicting types for 'arg5'
hid_wrap.c:2593: error: previous declaration of 'arg5' was here
hid_wrap.c:2642: error: initializer element is not constant
hid_wrap.c:2642: warning: data definition has no type or storage class
hid_wrap.c:2643: error: syntax error before '}' token
hid_wrap.c:2644: warning: type defaults to 'int' in declaration of
'result'
hid_wrap.c:2644: error: conflicting types for 'result'
hid_wrap.c:2594: error: previous declaration of 'result' was here
hid_wrap.c:2644: error: initializer element is not constant
hid_wrap.c:2644: warning: data definition has no type or storage class
hid_wrap.c:2646: warning: type defaults to 'int' in declaration of
'resultobj'
hid_wrap.c:2646: error: redefinition of 'resultobj'
hid_wrap.c:1828: error: previous definition of 'resultobj' was here
hid_wrap.c:2646: error: initializer element is not constant
hid_wrap.c:2646: warning: data definition has no type or storage class
hid_wrap.c:2647: error: syntax error before '{' token
hid_wrap.c:2659: error: syntax error before '*' token
hid_wrap.c:2659: error: syntax error before '*' token
hid_wrap.c:2661: error: redefinition of 'arg1'
This is caused by the python wrapper. I guess you don't have python installed (like me, I get the same errors).
Try:
./configure --disable-swig
make
It worked for me, for both the svn version and the tgz version. I put that hint in the README for the next release
--
Lars Krueger
http://LarsKrueger.homestead.com/files
mailto:lars_e_...@gmx.de
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail
> Try:
>
> ./configure --disable-swig
> make
Yup, that works, thanks. Now to configure usbhotkey... it says it
can't find libhid (which I just compiled and installed). How do I
specify its location (/opt/libhid)? Thanks.
-Daryl
Try
LDFLAGS="-L/opt/libhid" ./configure
Maybe you need
LDFLAGS="-L/opt/libhid" CFLAGS="-I/opt/libhid" ./configure
Maybe you need to do that for make too.
On Mar 30, 4:27 pm, "Lars Krueger" <lars_e_krue...@gmx.de> wrote:
> Try
> LDFLAGS="-L/opt/libhid" ./configure
>
> Maybe you need
> LDFLAGS="-L/opt/libhid" CFLAGS="-I/opt/libhid" ./configure
>
No, that didn't work. I recompiled libhid without specifying prefix
and that worked (usbhotkey configure found it). Now it can't find
imlib. I installed imlib-devel and that worked. For fun I installed
ruby-devel, too. Now it configures OK but doesn't compile. Here's the
entire make response:
make all-recursive
make[1]: Entering directory `/opt/downloads/usbhotkey-0.1'
Making all in images
make[2]: Entering directory `/opt/downloads/usbhotkey-0.1/images'
Making all in ag5
make[3]: Entering directory `/opt/downloads/usbhotkey-0.1/images/ag5'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/opt/downloads/usbhotkey-0.1/images/ag5'
make[3]: Entering directory `/opt/downloads/usbhotkey-0.1/images'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/opt/downloads/usbhotkey-0.1/images'
make[2]: Leaving directory `/opt/downloads/usbhotkey-0.1/images'
make[2]: Entering directory `/opt/downloads/usbhotkey-0.1'
gcc -DHAVE_CONFIG_H -I. "-I/usr/lib/ruby/1.8/i386-linux" -g -O2 -MT
main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
mv -f .deps/main.Tpo .deps/main.Po
gcc -g -O2 -o usbhotkey main.o -lXtst -lImlib -lhid -lruby
/usr/bin/ld: cannot find -lXtst
collect2: ld returned 1 exit status
make[2]: *** [usbhotkey] Error 1
make[2]: Leaving directory `/opt/downloads/usbhotkey-0.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/downloads/usbhotkey-0.1'
make: *** [all] Error 2
I'm going out of town this weekend, so I'll be back on this Sunday or
Monday. Thanks for your help, Lars.
-Daryl
Well I got a chance to work on it at home. I compiled and installed
everything but it fails to run with:
error while loading shared libraries: libhid.so.0: cannot open shared
object file: No such file or directory
I have libhid installed at
/usr/local/lib/libhid.so
Can I specify the location of libhid as a parameter to usbhotkey? (I
apologize for my ignorance, I develop in Java...)
-Daryl
usb_set_debug: Setting debugging level to 1000 (on)
usbhotkey: Loading script /usr/local/share/usbhotkey-0.1/ag5.rb
usbhotkey AG5 script starting
usbhotkey: Connecting to 0510:100b
Check that you have permissions to write to 002/001 and, if you don't,
that you set up hotplug (http://linux-hotplug.sourceforge.net/)
correctly.
USB error: could not claim interface 0: Device or resource busy
usbhotkey AG5 script started
usbhotkey: Starting event loop
I've checked my AG5's info via lsusb -vvv, and the information match
those in the script, so it should be connecting to the correct
device. What else can cause this error? I've setup Xorg to use evdev
for the AG5's mouse, could this be the culprit (although the mouse is
on a different end-point)?
-Bill
ldconfig
Do it as root. It scans your installed libraries and makes a cache file to find them later on.
To your other question: The error
can't find -lXtst
means that you don't have the X test extension installed. Your distribution should provide a package containing it. If not, check the forum/howto pages of your distribution.
This is a bogus error message of libhid. It basically means you can't access a part of your USB tree from your current user. If it gets past this message it also means that you don't actually need to access it.
> USB error: could not claim interface 0: Device or resource busy
Again, bogus message. Some device (I think it's the hub in the AG5) can't be opened.
> usbhotkey AG5 script started
> usbhotkey: Starting event loop
This is the important message here. If you get this far, everything works and you can pass events to X11. You should see the keymap display in the lower right of your screen.
I'll put a note about this in the README.
--
Lars Krueger
http://LarsKrueger.homestead.com/files
mailto:lars_e_...@gmx.de
Ah, I did notice something on the lower right corner of my screen, but
it appears that the images cannot load correctly, I get blank, white
buttons instead of the png images. The Ruby code point to the correct
paths so I'm not quite sure what's wrong. After trying to type this
message using my AG5, I also noticed that the bindings worked, so
everything seems fine except for the button layout image display.
-Bill
Ca'nt help you there. I copied the code from xteddy. Maybe your imlib does not have png support. You may try to change the filenames and convert to, say, JPG.
--
Lars Krueger
http://LarsKrueger.homestead.com/files
mailto:lars_e_...@gmx.de
I just found out via Ubuntu 6.10's package repository, that there's
imlib2 and there are already ruby extensions written for it as well.
Is there any reason not to use imlib2? Considering that it's possible
to install the imlib2 dependency via a ruby gem, this can simplify the
installation procedure a bit.
-Bill
Sorry, I meant, "imlib2-ruby" dependency.
-Bill
Can't say I "forgot" since I never knew... anyway, I tried it and it
didn't work. Maybe I'll go back to try to compile libhid with swig so
I can code in Python. Perhaps I'll have to wait 'til libhid comes out
in RPM (followed shortly by usbhotkey.rpm :-) )
Since the image display codes from xteddy (displays a cuddly teddy bear on your screen, nothing else), you might try to install it and maybe imlib is installed automatically.
I do have imlib installed from the package repository, I'm just
wondering why isn't imlib2 used instead, since that is suppose to
supersede imlib. Plus there's already ruby extensions written for
imlib2 so you don't need to write and compile your own (even though
you're only using a few functions).
I still haven't figure out why my imlib won't load the images
correctly (the transparent part works, but the opaque part only comes
in white. I've tried using jpeg and I just get a white box), I'll dig
in some more when I get the time.
I'm also thinking about moving the key bindings map to a YAML file, as
Ruby have excellent support for YAML (http://yaml4r.sourceforge.net/),
and YAML is also much more readable than XML.