Skip to content

Commit

Permalink
Updated EvDev Write-up with stylistic and wording changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
royalgraphx committed Jul 14, 2024
1 parent 6b46489 commit 6c30f46
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 36 deletions.
29 changes: 15 additions & 14 deletions docs/_writeups/07-EvdevKBM/01-Prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ parent: KB/M sharing with Evdev
nav_order: 1
---

# Prerequisites
#### What is Evdev, and what does it do?
**Evdev**, short for "**ev**ent **dev**ice", is a Linux input driver that supports almost all input devices, including keyboards, mice, game controllers, tablets, etc. It takes the raw input events from these devices and turns them into accessible files in the ``/dev/input/`` directory. These files can be then accessed to get input from such input devices. It is considered a type of **character device driver**, which turns raw data (in bytes) into files.
## What is Evdev, and what does it do?

**Evdev** is how Linux communicates with and gets the raw data from these input devices. In our use case, we will use **evdev** to passthrough these input devices into our virtual machine and configure a keyboard shortcut to allow sharing of our mouse and keyboard.
<br><br>
**Evdev**, short for "**Ev**ent **Dev**ice", is a Linux input driver that supports almost all input devices, including keyboards, mice, game controllers, and tablets. It takes the raw input events from these devices and turns them into accessible files in the ``/dev/input/`` directory. These files can be then accessed to get input from such input devices. It is considered a type of **Character Device Driver**, which turns raw data (in bytes) into files.

**Evdev** is how Linux communicates with and gets the raw data from these input devices. In our use case, we will use it to passthrough these input devices into our virtual machine and configure a keyboard shortcut to allow sharing of devices as we choose.
<br>

## Finding our keyboard and mouse

#### Finding our keyboard and mouse
Make sure your keyboard and mouse are plugged in and detected in Linux.

Let's check the input devices currently in use. Enter the following command into the terminal (on Linux):
Let's check the input devices currently in use. Enter the following command into the terminal:

```bash
ls /dev/input/by-id
```

Example output:

```txt
```bash
usb-30fa_USB_Optical_Mouse-event-mouse
usb-30fa_USB_Optical_Mouse-mouse
usb-EVGA_Z12_Gaming_Keyboard-event-if01
Expand All @@ -35,25 +36,25 @@ usb-EVGA_Z12_Gaming_Keyboard-if02-event-kbd

Only devices that have ``event`` in their names can be passed through. In the example output, the only devices that could be passed through would be

```txt
```bash
usb-30fa_USB_Optical_Mouse-event-mouse
usb-EVGA_Z12_Gaming_Keyboard-event-if01
usb-EVGA_Z12_Gaming_Keyboard-event-kbd
usb-EVGA_Z12_Gaming_Keyboard-if01-event-mouse
usb-EVGA_Z12_Gaming_Keyboard-if02-event-kbd
```

Now, we need to figure out which devices should be passed through. For each file in the output, check the contents via ``cat``. For instance,
Now, we need to figure out which devices should be passed through. For each file in the output, check the contents via ``cat``. For instance:

{: .note }
Remember to Control-C out of the process after!

```bash
cat /dev/input/by-id/usb-30fa_USB_Optical_Mouse-event-mouse
```

Move your cursor or type something on your keyboard. If the terminal spits out garbled characters, that is the correct device. If not, try the other devices in the list.

> [!NOTE]
> Remember to Control-C out of the process after!
Now that you have the two devices, note the paths of these input devices. These will be the devices that we will pass through to our virtual machine.

## You can now continue to the next <a href="./02-EditingConfig">page</a>.
## You can now continue to the next <a href="../02-EditingConfig">page</a>.
4 changes: 2 additions & 2 deletions docs/_writeups/07-EvdevKBM/02-EditingConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parent: KB/M sharing with Evdev
nav_order: 2
---

# Editing Config Files
## Editing Config Files

Use your favorite text editor to make the following changes to:

Expand Down Expand Up @@ -54,4 +54,4 @@ Save the file, then restart the libvirtd service.
systemctl restart libvirtd
```

## You can now continue to the next <a href="./03-AddingToXML">page</a>.
## You can now continue to the next <a href="../03-XML">page</a>.
18 changes: 9 additions & 9 deletions docs/_writeups/07-EvdevKBM/03-XML.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ nav_order: 3

# XML Modifications

> [!WARNING]
{: .warning }
> In order to use ``evdev``, we will need to **remove the USB controller from our machine**. Otherwise, the controller will capture the USB (and input) devices first, thus removing the files from ``/dev/input/by-id/``.
>
> If you really want to pass in USB devices, try passing in the USB devices directly via USB passthrough, or utilize a secondary USB controller for passthrough.
> If you really want to pass in USB devices, try utilizing a secondary USB controller for passthrough. Using USB Host Device is not recommended. QEMU's USB Controllers are non compliant and on OS X / macOS do not provide proper functionality for basics such as iPhone Sync, and the likes.
First, let's remove the USB controller from the virtual machine.

<p align="center">
<img src="../../assets/VManRemoveUSBController.png"/>
<img src="../../../assets/VManRemoveUSBController.png"/>
</p>

Now, we need to edit the XML of the virtual machine. Go to Overview > XML, and scroll down until you see the following lines:
Expand All @@ -36,7 +36,7 @@ Now, **before** the mouse and keyboard XML, copy and paste the following XML to
</input>
```

> [!NOTE]
{: .note }
> The ``grabToggle`` option will be the keyboard shortcut to switch the keyboard and mouse focus from host (Linux) and guest (macOS). This can be configured to the keyboard shortcut that you prefer. By default, it will be ``'ctrl-ctrl'``, but this option can be configured to the following options:
> - ``'alt-alt'``
> - ``'shift-shift'``
Expand All @@ -46,24 +46,24 @@ Now, **before** the mouse and keyboard XML, copy and paste the following XML to

<p align="center">
<img src="../../assets/VManAddingEvdevDevices.png"/>
<img src="../../../assets/VManAddingEvdevDevices.png"/>
</p>

> [!NOTE]
{: .note }
> Remember to **'Apply'** when you finish!
You should then see two 'Input' devices in the sidebar!

Sample configuration for the mouse (should be similar for keyboard as well):

<p align="center">
<img src="../../assets/VManEvdevInputDetails.png"/>
<img src="../../../assets/VManEvdevInputDetails.png"/>
</p>

<p align="center">
<img src="../../assets/VManEvdevInputXML.png"/>
<img src="../../../assets/VManEvdevInputXML.png"/>
</p>

**Do not boot into DarwinKVM yet! We still need to configure the driver/kext for KB/M!**

## You can now continue to the next <a href="./04-AddingToKext">page</a>.
## You can now continue to the next <a href="../04-VoodooPS2">page</a>.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
---
layout: default
title: Adding the required kexts
title: Adding VoodooPS2
parent: KB/M sharing with Evdev
nav_order: 4
---
# Adding the Required Kexts
## Adding VoodooPS2

Start by downloading the latest release version of ``VoodooPS2`` from <a href="https://github.com/acidanthera/VoodooPS2/releases/">here</a> (for macOS 10.12 Sierra and higher).

> [!NOTE]
{: .headsup }
> For **OSX 10.11** (El Capitan) and lower, you will instead need to download the original PS2 driver by **RehabMan** <a href="https://bitbucket.org/RehabMan/os-x-voodoo-ps2-controller/downloads/">here</a>. Note that these older drivers are built for x64 systems, but you can manually build the x32 versions in Xcode with the source code <a href="https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/">here</a>.
Add the kext to the OC folder, and remember to ``OC Snapshot`` the ``config.plist`` when finished. The necessary kexts (``VoodooPS2Keyboard, VoodooPS2Mouse``) will be installed automatically for you.
Start by downloading the latest release version of ``VoodooPS2`` from <a href="https://github.com/acidanthera/VoodooPS2/releases/">here</a> (for macOS 10.12 Sierra and higher).

Add the kext to the Kexts folder in your OpenCore disk image, and remember to ``OC Snapshot`` the ``config.plist`` when finished. The necessary kexts (``VoodooPS2Keyboard, VoodooPS2Mouse``) will be added automatically for you by ProperTree.

Now, boot up macOS, and enjoy switching your keyboard and mouse from macOS to Linux!

> [!NOTE]
{: .note }
> Usually, the **Option (⌥)** and **Command (⌘)** keys on the keyboard maps to the **Alt** and the **Windows (⊞)** keys respectively. The original PS2 driver (by RehabMan) will swap these keymaps, however.
> <br/> <br/>
>
> You can change this behavior is to go to **Settings > Keyboard > Keyboard Shortcuts > Modifier Keys** (or something equivalent) in macOS, and swap the action keys for Option (⌥) and Command (⌘).
#### Thanks for reading!
#### Thanks for reading!
4 changes: 2 additions & 2 deletions docs/_writeups/07-EvdevKBM/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ has_children: true
---

<p align="center">
<img width="650" height="200" src="../../assets/HeaderEvdevKBM.png">
<img width="650" height="200" src="../../../assets/HeaderEvdevKBM.png">
</p>

This guide will show you how to configure Evdev to allow the host (Linux) and the guest (OS X/macOS) to share a mouse and keyboard with a simple keyboard shortcut!
This guide will show you how to configure Evdev to allow the host (Linux) and the guest (OS X / macOS) to share a mouse and keyboard with a simple keyboard shortcut!

0 comments on commit 6c30f46

Please sign in to comment.