Search this site

[prev]  Page 2 of 3  [next]





Interesting FreeBSD rc.conf network option

In rc.conf, I can put:
And do /etc/rc.d/netif restart bge0

and we get:

% ifconfig bge0
        inet netmask 0xffffff00 broadcast
        inet6 fe80::20a:e4ff:fe3f:92ee%bge0 prefixlen 64 scopeid 0x1 
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffff00 broadcast
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffffff broadcast
        ether 00:0a:e4:3f:92:ee
        media: Ethernet autoselect (none)
        status: no carrier
Neat. That's one way to take an entire subnet.

Mini-FreeBSD script

I wrote a script a while ago to build a very tiny freebsd world. It's extremely fast and only builds a freebsd image in approximately 10 megs of space. It lets you quickly create new jail enviroments or system images for small embedded platforms.

If you look at the script itself, you'll get an idea of what it installs. I used a variant of this script to build the system I run on my Soekris net4501 which runs FreeBSD and is under 20 megs.

There are lots of "make a small freebsd system" scripts, but most of the ones I've found rely heavily on 'buildworld' and what not. This takes a live system and copies the binaries you need, then uses ldd(1) to track down required libraries.


Example usage:

kenya(~/t) % rm -rf ./soekris/
kenya(~/t) % time sudo ./
sudo ./   0.16s user 0.65s system 61% cpu 1.326 total
kenya(~/t) % sudo chroot ./soekris /bin/sh
# pwd
# exit
Simple jail config (rc.conf):
Put something simple in this jail's rc.conf (/home/jls/t/soekris/etc/rc.conf):
Let's test the jail now:
kenya(~/t) % sudo /etc/rc.d/jail start
Configuring jails:.
Starting jails: 
At this point, it's probably hung (assuming you enabled sshd). If you hit CTRL+T you'll see what command has the foreground and what it's doing.* This is because it's prompting you (output is directed to JAILROOT/var/log/console.log) for entropy for the ssh-keygen. Smash a few keys then hit enter. It'll finish eventually.
kenya(~/t) % sockstat -4 | grep 
root     sshd       2258  3  tcp4           *:*
Our sshd is running happily inside that jail we made. This whole process took about 5 minutes.

* FreeBSD's CTRL+T terminal handler feature has to be the best thing ever invented. I wish Linux had something like this. Here's what hitting CTRL+T when running cat looks like:

kenya(~) % cat
load: 0.45  cmd: cat 2324 [ttyin] 0.00u 0.00s 0% 600k
load: 0.42  cmd: cat 2324 [ttyin] 0.00u 0.00s 0% 600k
It clearly shows you the command name, the pid, and the syscall-type-thing it's doing. Clearly cat is waiting for input from the tty. <3 FreeBSD.

Kyocera KPC650 working in FreeBSD 6.1

I finally got my Verizon EVDO card working in FreeBSD. The following steps are necessary:
  1. Add a new vendor line to sys/dev/usb/usbdevs
  2. Add a new product line to sys/dev/usb/usbdevs
  3. Download
  4. Update sys/conf/files with a new entry

usbdevs changes

In /usr/src/sys/dev/usb/usbdevs, add the following:
vendor QUALCOMM3        0x0c88  Qualcomm
product QUALCOMM3 CDMA_MSM      0x17da  CDMA Technologies MSM phone

Download ugencom.c"

Download this to /usr/src/sys/dev/usb/ugencom.c. Now, you need to make a slight change to this file. Change the following the following line:

To this:

Update sys/conf/files

In /usr/src/sys/conf/files, add the following just after the line containing 'uplcom.c'
dev/usb/ugencom.c               optional ugencom ucom

Build your kernel

Add the following to your kernel:
device ucom
device ugencom
Rebuild your kernel. This device should show up as a usb serial device: /dev/cuaU0


This is mostly stolen from another fellow, but modified the authname and added the comment regarding it.
# Start by running ppp -ddial evdo  
 set device /dev/cuaU0
 set speed 230400
           \"\" AT OK-AT-OK ATE1Q0s7=60 OK \\dATDT\\T TIMEOUT 40 CONNECT"
 set phone "#777"
 # The authname and authkey are meaningless, but you need to have them set.
 # Verizon's servers don't seem to care what you auth as.
 set authname "doesn't matter"
 set authkey "doesn't matter either"
 set ifaddr
 add default HISADDR                    # Add a (sticky) default route
 enable dns

FreeBSD 6.1 on Thinkpad X41

I installed FreeBSD 6.1 on my corp laptop tonight. The following are notable:
  • acpi_ibm doesn't appear to read much of anything useful. hotkey values work. Little else
  • cpufreq works
  • wacom stylus input magic works via X 'wacom' driver. Shows up as /dev/cuad1
  • ath0 works
  • bge0 works
  • sata works
  • Tablet buttons (rotate/tools/esc/enter/ctrlaltdel) are received by X (viewable by xev(1))
wacom was not properly calibrated initially. Guess-and-check method of screwing with calibration values made everything happy.

I'll post configs and other notes later. Naptime.

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.


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"


FreeBSD 6.1 sparc64 as a desktop

I have an ultra10 here that was, until today, running Solaris 10 and was my desktop. Now, I have opted to install FreeBSD on it to see how it runs. I now have X running happily. Documentation on the specific pieces of information I wanted was sparse, so here's what I know now:

  • If your sparc64 is old and lacks USB, the mouse will show up as a serial device. The mouse device is the uart device immediately following the keyboard one:
    uart0:  on puc0
    uart0: CTS oflow
    uart1:  on puc0
    uart1: CTS oflow
    uart2: <16550 or compatible> addr 0x14003083f8-0x14003083ff irq 41 on ebus0
    uart2: keyboard (1200,n,8,1)
    uart3: <16550 or compatible> addr 0x14003062f8-0x14003062ff irq 42 on ebus0
    Here, uart3 is my mouse.
    This means that /dev/cuau3 is my mouse. So I add this in rc.conf:
    Run /etc/rc.d/moused start, and the mouse works.
  • X needs to be told what keyboard map you are using. I used X -configure to generate my xorg.conf. A few changes are necessary:

    I have a Sun type5 keyboard, so, in my xorg.conf:

    Section "InputDevice"
       Identifier  "Keyboard0"
       Driver      "kbd"
       Option  "AutoRepeat" "400 30"
       Option "XkbRules" "sun"
       Option "XkbModel" "type5"
       Option "XkbLayout" "us"
       Option "XkbKeycodes" "sun(type5)"
  • X needs to be told about the monitor and what proper resolution:
    Section "Monitor"
            Identifier   "Monitor0"
            VendorName   "Monitor Vendor"
            ModelName    "Monitor Model"
            HorizSync 31.5-110
            VertRefresh 75
    Section "Screen"
            Identifier "Screen0"
            Device     "Card0"
            Monitor    "Monitor0"
            DefaultDepth 16
            SubSection "Display"
                    Depth     16
                    Modes "1024x768"

newpsm/newmoused update - merge into -CURRENT preparation

Lots of hours were spent today preparing the new moused and psm code for import into the FreeBSD source tree. I don't have a commit bit to CVS, so I'll have to wait on having it committed. This wait time will probably be spent fixing bugs, writing a decent rc script, and improving configuration options.

This update is only known to work for -CURRENT. The patch can be found on the newpsm project page. I had a friend test the patch against 6.0-RELEASE, and it seemed to apply cleanly with the exception that patch(1) got confused about sys/sys/mouse.h. Tell patch to not attempt to reverse-apply the patch, then tell it yes for trying the patch anyway. No guarantees if it doesn't build.

You can find almost all the information you need on the newpsm project page. If you find bugs, are interested in helping test, or have questions or comments, please contact me :)

Configuration file support added to moused and its modules

With the simple api that is getcap(3), moused and it's device modules will soon be able to be configurable from config files. The code is still in perforce to do this, however, and not on this site (at time of writing). A simple config file could be something like this:
This would modify options ONLY for the synaptics driver and enable "virtual scrolling" and disable the touchpad. Currently, only 'notouchpad' is supported (again, at time of writing).

I really want to add lots of options, mostly for synaptics support, but this would allow for some serious flexibility in mouse configuration. You can specify any kind of mouse you want and whatever config you please. Personally, I'd love to see an option to disable movement on the touchpad, and only allow the touchpad to be used for scrolling. Furthermore, allow me to decrease the sensitivity of the touchpad so that near-finger touches and palm touches don't trigger scrolling.

Wee! I love programming for fun. Makes me glad I'm not going to ever be a software developer. I like to code for myself and for my own goals.

FreeBSD new psm and moused ready for testing

I posted this to [email protected], so I might aswell post it here too.

I've been working on a userland-ification of psm(4) and a complete rewrite of moused(8). The new psm(4) driver lacks protocol understanding and expects to be controlled through ioctls only. The new moused(8) is designed such that mouse drivers are in the userland.

I have implemented 3 driver modules thus far:

  • Synaptics Touchpad (ps/2 only, not usb)
  • Generic PS/2
  • sysmouse (for ums(4) and mse(4))
Development has been done in 6.x (I don't have a -current machine handy) but this will probably work fine in -current.

Directions on what to do can be found on the project's site:

Comments/suggestions welcome :)