# Beginner questions: wireless, and X on a laptop



## marktuson (Oct 25, 2010)

Hello everyone. I'm actually a Linux user, but I've been interested in BSD for longer than I was in Linux - my main reason for getting into Linux was the bigger userbase and therefore (so I thought) better support.

I've been using Debian on an old Laptop for a while now, but since the newest update borked my screen up I've yet again considered making the jump (on that machine, at least) to FreeBSD. I did have it installed on that machine briefly at one point, but gave it up after seemingly not being able to persuade the mouse to work when I started X, even though the mouse daemon always worked when I tested it.

I've asked about that problem before (not here, though), and all that I've ever been told has been either '_stop trying to be geeky, just use Linux,_' or '_the BSDs are meant for servers, not users._' I'm not trying to be geeky, I'm just trying to learn, and I don't care what BSD was written for, it looks like it would be useful to me.

So that's my first question: how can I get the mouse to work on a laptop running FreeBSD 8.1?

My second question is: is there a (preferably simple) way to use wireless from the commandline?

Thanks very much.


----------



## SirDice (Oct 25, 2010)

marktuson said:
			
		

> So that's my first question: how can I get the mouse to work on a laptop running FreeBSD 8.1?


Most likely cause is hald and dbus not running. Handbook: 5.4 X11 Configuration
Also see this thread: Thread 4224



> My second question is: is there a (preferably simple) way to use wireless from the commandline?


That depends.

Handbook: 31.3 Wireless Networking


----------



## vermaden (Oct 25, 2010)

marktuson said:
			
		

> I did have it installed on that machine briefly at one point, but gave it up after seemingly not being able to persuade the mouse to work when I started X, even though the mouse daemon always worked when I tested it.





			
				marktuson said:
			
		

> So that's my first question: how can I get the mouse to work on a laptop running FreeBSD 8.1?



Check that guide mate, I use it that way and it works like a charm:
http://forums.freebsd.org/showthread.php?t=7956

In case You would run KDE/GNOME, stick with 'default' way with HALD/DBUS enabled.



			
				marktuson said:
			
		

> '_stop trying to be geeky, just use Linux_'


So Linux is not geeky anymore? LOL 



			
				marktuson said:
			
		

> My second question is: is there a (preferably simple) way to use wireless from the commandline?



If that part below is simple enought for You, then yes 

Create wlan0 device over your physical wireless interface (lets assume its iwn0):

```
# ifconfig wlan0 create wlandev iwn0
```

Scan for available networks:

```
# ifconfig wlan0 list scan
SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
NETIA-E0D99D    00:23:8e:e0:d9:9f    1   54M -88:-95  100 EP   WPA
dlink222        00:1b:11:8e:eb:1a    6   54M -87:-95  100 EPS  WPA
_home           00:25:9c:63:cb:69   13   54M -93:-95  100 EP   RSN WPA
```

Add that network with needed password to configuration:

```
# cat >> /etc/wpa_supplicant.conf << EOF
network={
  ssid="_home"
  psk="SECRET"
}
EOF
```

Connect to the access point:

```
# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
```

As You are connected, get IP address by DHCP:

```
# dhclient wlan0
```

... and if You use the wireless network at same location every time, you do not have to type these at all, because as all these commands would be done at boot process and as *login: *prompt shows, You will have Internet connection already available. You will only have to add new networks, as *wpa_supplicant* would switch automatically between added networks when needed.


----------



## marktuson (Oct 26, 2010)

Wicked, thanks. There's maybe two or three places where I might need wlan access (home, college, and my mate's house), so once they're set up all will be well.

Yeah, apparently Linux isn't all that geeky any more. Suits me fine, to be honest; I use Plan 9 for my geekiness


----------



## aragon (Oct 26, 2010)

vermaden said:
			
		

> Connect to the access point:
> 
> ```
> # wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
> ...


I find it simpler to do the above in one step with:


```
/etc/rc.d/wpa_supplicant start wlan0
```


----------



## vermaden (Oct 27, 2010)

aragon said:
			
		

> I find it simpler to do the above in one step with:
> 
> 
> ```
> ...



... but this requires both wlans_iwn0="wlan0" and ifconfig_wlan0="WPA DHCP" in */etc/rc.conf* 

Also I wanted to show 'pure' CLI way without start/stop scripts.


----------



## rhyous (Oct 27, 2010)

You can also check out how PCBSD does it.

They use create a lagg interface and link it to both the wired and wireless, so no matter which you connect with, you are working.  

And it is handy for me that the lagg interface uses the same MAC address whether you are wired or wireless.  I always get the same IP whether wired or wireless from my DHCP server.


----------



## vermaden (Oct 27, 2010)

@rhyous

You can do the same on FreeBSD:
http://freebsd.org/doc/handbook/network-aggregation.html#NETWORKING-LAGG-WIRED-AND-WIRELESS


----------

