Search this site


[prev]  Page 2 of 2

Metadata

Articles

Projects

Presentations

New keynav release available

This release of keynav adds necessary support for configuration files and the benefits obtained from dynamic configuration.

View the project page and/or download keynav-20070629.tar.gz

Update: 20070627 had problems with $HOME so I released a new version (0629).

xdo - do (keyboard or mouse) things in X

Update: xdotool is now a full project, see this page. It supports much more than just mouse and keyboard things.

Yesterday, I talked about macros. I spent some time coding today and I now have a tool that will let you execute raw keyboard and mouse input into X using the XTEST extension.

The primary example I used was focusing firefox's URL bar without the mouse. The sequence was this: Switch to Desktop 2 (I press Alt+2), focus firefox's URL bar (using control+l) and clear it.

The result is a simple tool I'm tentatively calling 'xdo'. You can download the source here. Compile instructions are at the top of the file.

The top of xdo.c details the implemented commands, so let's cut to an example:

% echo 'key alt+2; sleep 1; key ctrl+l; key BackSpace' | ./xdo
It does exactly what you think. The 'sleep' command has values in milliseconds, and is only necessary to slow down so that events can propgate fast enough (window focus changes, etc).

Another reasonable example would be to say "firefox, open a new tab and load the URL in my clipboard":

# My clipboard contains a valid url, say, "http://www.google.com/"
(echo "key alt+2; sleep 1; key ctrl+l; key BackSpace;"
 echo "move 55 55; sleep 1; click 2; key Return") | ./xdo
Seems complex, but look at what's really happening: Go to desktop 2, focus urlbar, hit backspace (clearing it), move the mouse cursor to 55,55 (a point inside the urlbar for me), hit middle mouse button to paste.

Change "ctrl+l" to ctrl+k (unix firefox) to focus the "Search" box instead, and change the 'move' command to cursor over the search box to paste instead, and suddenly you can bind a simple keystroke to search for whatever is in your X clipboard. Useful.

One of the neater features is that you can 'type' text:

% echo 'type echo hello there; key Return' | ./xdo
echo hello there
% echo hello there
hello there

USB Mouse support in newmoused, working.

I've got my usb mouse working with the new moused. Most of the code in the module is ripped from usbhidctl(1). Now that I *actually* know how things work, I found that the read() wasn't actually one with side effects. Good.

You'll need the new moused framework for this module.

Basic instructions:

  1. Download my moused framework (newpsm project on this site)
  2. Recompile your kernel without "device ums"
  3. Build moused, build the usbmouse module.
  4. Run moused: ./moused -m usbmouse -d /dev/uhid0
If it doesn't work, let me know.

moused-usbmouse.tar.gz

Future plans:

  • Rewrite ugly bits
  • Port ums(4) hacks for broken mice
  • Test with more mice
  • Write uhid joypad support

USB Mouse support in-progress for newmoused/newpsm

I started working on usb (usbhid) mouse support for my newpsm/newmoused project. So far so good, I can probe /dev/uhidX devices and figure out if it's a mouse or not. Thankfully, usb hid is very easy. Unfortunately, FreeBSD (NetBSD's) implementation is somewhat crazy with the voodoo.

To see what I mean, look at: src/usr.sbin/usbhidct/usbhid.c.

Look near line 230 (the only read() call in the file). Notice the read() call, but 'dbuf' is NEVER used meaningfully. More specifically, the read is mostly ignored and a loop is done over the 'hids' list. Looks like read()s on usbhid devices pushes data to special places in memory which can be found by using hid_start_parse(). A read() shouldn't be doing this. This is the job for an ioctl() or something. read(), to me, says "give me data so I can use it" - not "update some magic places in memory, thanks"

Eek.

pam_captcha 1.2 updated

This update fixes a few potential bugs and cleans up some other issues. I removed the 'cowsay' requirement and made the math and dda captchas compile-time options.

Check out the project page for information on pam_captcha and downloading it.
pam_captcha