# How do I install my device drivers on FreeBSD?



## Redlonmas (Apr 9, 2021)

Greetings. First of all, I am very sorry if I opened the subject in the wrong place. I am not familiar with this forum and am not very good at writing and speaking in English.  
I have been using other unix-like operating systems for a very long time. (Linux) But I've never been into the FreeBSD world before.
For this reason in the system device I don't know if (graphic card, touchpad) drivers are installed.

My system features are as follows;

Specifications​Lenovo Ideapad 320-15IAP-80XR019ESP 
Processor
Intel Celeron N3350 2 x 1.1 - 2.4 GHz, Apollo Lake
Graphics adapter
Intel HD Graphics 500
Memory
8 GB  


Display
15.60 inch 16:9, 1366 x 768 pixel 100 PPI, TN, glossy: no
Storage
 500 GB HDD
Connections
2 USB 3.0 / 3.1 Gen1, 1 HDMI, Card Reader: undefined
Networking
802.11 a/b/g/n/ac (a/b/g/n = Wi-Fi 4/ac = Wi-Fi 5), Bluetooth 4.1
I would appreciate it if you could help me on how to install the necessary drivers. 
(touchpad does not work. and I don't know my graphics card driver setup)


----------



## SirDice (Apr 9, 2021)

With regards to the graphics driver, install graphics/drm-kmod and things should work fine. Assuming you installed FreeBSD 12.2 or the latest 13.0 release.


----------



## olli@ (Apr 9, 2021)

Basically, the standard FreeBSD installation media contain almost all the drivers that you need. A notable exception is the graphics driver, as SirDice has mentioned above, you’ll need to install that package. Then Xorg should run almost exactly the same as you’re used to on Linux.
 
Regarding the WiFi NIC, FreeBSD’s support for the newer standards is somewhat weak. Depending on what chip it is exactly, at least a/b/g/n should work, but I’m not sure about ac (I try to avoid WiFi with FreeBSD myself). If possible, use a wired network connection, i.e. RJ45 cable. These usually have excellent FreeBSD support. If your machine doesn’t have an RJ45 port, alternatively you can use a USB network adapter.
 
Similarly, FreeBSD’s support for Bluetooth is rather weak, especially for Bluetooth audio devices (wireless speakers, headphones, etc.). If you’re lucky it works, but it may as well fail to work. If you need this, there are certain kinds of workarounds, e.g. see this thread.
 
There are a few useful commands for looking at your hardware and drivers. Most of them require root privileges, i.e. type them as the “root” user.

`pciconf -lv` lists all PCI devices, whether FreeBSD has a driver for it or not. If you see something like `noneX@pciX:…` at the beginning of a line, then no driver is attached to this device.
`usbconfig` lists all USB devices that are currently attached (whether supported by a specific driver or not). This includes the internal “root hubs”, so don’t be surprised if the list is longer than expected.
`dmesg` can be used to review the kernel’s boot messages. Use `dmesg -a` to include other output that has been printed to the system console. Note that the dmesg buffer is circular, so it is overwritten after a while, and the oldest entries get lost. In this case you can look at the file /var/run/dmesg.boot that contains a snapshot of the buffer right after the boot process has finished.
`cat /dev/sndstat` lists the audio devices that have been found on your system. The list is dynamic, i.e. when you plug in a USB audio device, it will appear in that list. The one marked as “default” will be used by most software by default, unless you specify a different device.
`gpart show` gives a nice overview of the disk partitions (including file systems). `geom -t` produces similar information in a hierarchical, tree-like layout, although there are less details printed per entry. Another useful command is `diskinfo -v ada0` to get detailed information about a certain disk (in this example it’s `ada0` which is the first SATA drive).


----------



## Redlonmas (Apr 9, 2021)

olli@ said:


> Basically, the standard FreeBSD installation media contain almost all the drivers that you need. A notable exception is the graphics driver, as SirDice has mentioned above, you’ll need to install that package. Then Xorg should run almost exactly the same as you’re used to on Linux.
> 
> Regarding the WiFi NIC, FreeBSD’s support for the newer standards is somewhat weak. Depending on what chip it is exactly, at least a/b/g/n should work, but I’m not sure about ac (I try to avoid WiFi with FreeBSD myself). If possible, use a wired network connection, i.e. RJ45 cable. These usually have excellent FreeBSD support. If your machine doesn’t have an RJ45 port, alternatively you can use a USB network adapter.
> 
> ...


Thank you for your long article on this topic.
I executed the command to list PCI devices via terminal.
Many have words like (none1 @ pci0: 0: 23: 0  at the beginning. Isn't there any way to install them?


----------



## mickey (Apr 9, 2021)

Redlonmas said:


> Many have words like (none1 @ pci0: 0: 23: 0  at the beginning. Isn't there any way to install them?


Please post the output of `pciconf -lv | grep -A 3 -E "^none"`, that should list only those devices with no driver assigned.


----------



## Redlonmas (Apr 9, 2021)

mickey said:


> Please post the output of `pciconf -lv | grep -A 3 -E "^none"`, that should list only those devices with no driver assigned.


----------



## olli@ (Apr 9, 2021)

Redlonmas said:


> I executed the command to list PCI devices via terminal.
> Many have words like (none1 @ pci0: 0: 23: 0  at the beginning. Isn't there any way to install them?


It depends what kind of devices those are exactly. Are you needing support for a specific device in particular? Which one is it?
 
For example, on my workstation I have these:

```
none0@pci0:0:0:2:       class=0x080600 card=0x87471043 chip=0x14511022 rev=0x00
hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Family 17h (Models 00h-0fh) I/O Memory Management Unit'
    class      = base peripheral
    subclass   = IOMMU
```
That’s the processor’s internal MMU (memory management unit). The FreeBSD kernel already handles the memory management without requiring a specific driver for this device.

```
none1@pci0:13:0:0:      class=0x130000 card=0x87471043 chip=0x145a1022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Zeppelin/Raven/Raven2 PCIe Dummy Function'
    class      = non-essential instrumentation
none3@pci0:14:0:0:      class=0x130000 card=0x87471043 chip=0x14551022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Zeppelin/Renoir PCIe Dummy Function'
    class      = non-essential instrumentation
```
To be honest, I have no idea what these things really are. But the above output sounds like they’re not something that I really need a driver for. 

```
none2@pci0:13:0:2:      class=0x108000 card=0x87471043 chip=0x14561022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Family 17h (Models 00h-0fh) Platform Security Processor'
    class      = encrypt/decrypt
```
If you’re curious, you can read about that beast on Wikipedia. No open source drivers exist for this (neither Linux nor BSD nor others), and – frankly – I don’t think I _want_ to do anything with it.


----------



## mickey (Apr 9, 2021)

olli@ said:


> ```
> class = non-essential instrumentation
> ```
> To be honest, I have no idea what these things really are.


I guess the class pretty much sums it up


----------



## Redlonmas (Apr 9, 2021)

olli@ said:


> It depends what kind of devices those are exactly. Are you needing support for a specific device in particular? Which one is it?
> 
> For example, on my workstation I have these:
> 
> ...


I want the Touchpad to work. It worked on Linux too, but FreeBSD doesn't work either.


----------



## mickey (Apr 9, 2021)

Redlonmas said:


> I want the Touchpad to work. It worked on Linux too, but FreeBSD doesn't work either.


The pci devices with no driver attached are nothing to worry about, those are integrated devices on the mainboard that you will see on most hardware. As for the touchpad, the first question would be whether it operates as a PS/2 mouse or is connected by means of some specialized i2c bus interface. If it's PS/2, it should appear as psm0, so you can check your boot messages if it was found: `dmesg | grep psm` should show something similar to:

```
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Generic PS/2 mouse, device ID 0
```
If there is nothing, than chances are it operates in i2c mode and requires a specialized driver (that might not be available). Some BIOS setups allow you to change the operating mode of the touchpad. Check your BIOS settings if there is anything related to touchpad. Modes could be called something like _Basic_ and _Enhanced_ or similar. If you find such a setting, try changing it, reboot and check again whether psm0 is found.


----------



## Redlonmas (Apr 9, 2021)

I don't think there will be a problem with the BIOS. There is probably a lack of drivers. Also, the command you gave did not give any output in the text. ( dmesg | grep psm)


----------



## SirDice (Apr 9, 2021)

Two of them will disappear if you load smbus(4). Just add `kld_list="smbus"` to /etc/rc.conf (or add the `smbus` to the existing list of modules in `kld_list`)


----------

