The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 USB keyboards + usbd = fun
Author: Doug White 
Date:   19-12-01 02:59

After a bit of experimentation I've found that you can (ab)use usbd to reset the console keyboard for you.

Insert a block like this into /etc/usbd.conf then kill -HUP usbd:

Device "Keyboard"
devname "ukbd[0-9]+"
attach "/usr/sbin/kbdcontrol -k /dev/kbd1 < /dev/console"

This causes usbd to reset the console keyboard to kbd1, which is usually always the USB keyboard you've just plugged in. If you plug in multiple USB keyboards then you'll have to switch them manually, but I don't exactly find that a common configuration. :) Some creative scripting could improve the intelligence if you regularly use lots of USB keyboards.

When you unplug the keyboard, syscons automatically reverts to kbd0, which will be the atkbd if you've cleared the flags on it.

More information can be found on the usbd.conf(5) man page.

Reply To This Message
 Re: USB keyboards + usbd = fun
Author: paul 
Date:   13-01-03 05:17

I haven't gotten this to work.

I get usbd to dump core each time. Running usbd in debug mode gives me this.

[/usr/home/paul]# usbd -vvvvvvvvvvvv
usbd: opened /dev/usb0
usbd: reading configuration file /etc/usbd.conf
usbd: action 1: ActiveWire board, firmware download
vndr=0x0854 prdct=0x0100 rlse=0x0000
attach='/usr/local/bin/ezdownload -f /usr/local/share/usb/firmware/0854.0100.0_01.hex ${DEVNAME}'
usbd: action 2: Entrega Serial with UART
vndr=0x1645 prdct=0x8001 rlse=0x0101
attach='/usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/${DEVNAME}'
usbd: action 3: USB ethernet
devname: [ack]ue[0-9]+
attach='/etc/pccard_ether ${DEVNAME} start'
detach='/etc/pccard_ether ${DEVNAME} stop'
usbd: action 4: Handspring Visor
vndr=0x082d prdct=0x0100 rlse=0x0100
devname: ugen[0-9]+
attach='/usr/local/bin/coldsync -md -p /dev/${DEVNAME} -t usb'
usbd: action 5: Mouse
devname: ums[0-9]+
attach='/usr/sbin/moused -p /dev/${DEVNAME} -I /var/run/moused.${DEVNAME}.pid ; /usr/sbin/vidcontrol -m on'
usbd: action 6: USB device
usbd: 6 actions
usbd: opened /dev/usb

here's what I added:

device "Keyboard"
devname "ukbd[0-9]+"
attach "/usr/sbin/kbdcontrol -k /dev/kbd0 < /dev/console"

and here's what I get:

[/usr/home/paul]# usbd -vvvvvvvvvvvv
usbd: opened /dev/usb0
usbd: reading configuration file /etc/usbd.conf
Segmentation fault (core dumped)

I tried kdb1 as well: some deal.

Any ideas?

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 

 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Remember my login:
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum