[GLOBAL] Update
This commit is contained in:
parent
e6372f3f3a
commit
caf8e08e8c
5 changed files with 72 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
font:
|
||||
normal:
|
||||
family: FiraCode NF
|
||||
background_opacity: 0.5 # Require `picom -f &` in .xinitrc
|
||||
window:
|
||||
opacity: 0.5 # Require `picom -f &` in .xinitrc
|
||||
|
|
1
configs/kvm/usbhotplug/README.md
Normal file
1
configs/kvm/usbhotplug/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/olavmrk/usb-libvirt-hotplug
|
31
configs/kvm/usbhotplug/plug.sh
Executable file
31
configs/kvm/usbhotplug/plug.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
# sudo virsh attach-device "$1" "$2.xml"
|
||||
|
||||
DOMAIN=$1
|
||||
COMMAND="attach-device"
|
||||
|
||||
#
|
||||
# This is a bit ugly. udev passes us the USB bus number and
|
||||
# device number with leading zeroes. E.g.:
|
||||
# BUSNUM=001 DEVNUM=022
|
||||
# This causes libvirt to assume that the numbers are octal.
|
||||
# To work around this, we need to strip the leading zeroes.
|
||||
# The easiest way is to ask bash to convert the numbers from
|
||||
# base 10:
|
||||
#
|
||||
BUSNUM=$((10#$2))
|
||||
DEVNUM=$((10#$3))
|
||||
|
||||
#
|
||||
# Now we have all the information we need to update the VM.
|
||||
# Run the appropriate virsh-command, and ask it to read the
|
||||
# update XML from stdin.
|
||||
#
|
||||
echo "Running virsh ${COMMAND} ${DOMAIN} for USB bus=${BUSNUM} device=${DEVNUM}:" >&2
|
||||
virsh "${COMMAND}" "${DOMAIN}" /dev/stdin <<END
|
||||
<hostdev mode='subsystem' type='usb'>
|
||||
<source>
|
||||
<address bus='${BUSNUM}' device='${DEVNUM}' />
|
||||
</source>
|
||||
</hostdev>
|
||||
END
|
31
configs/kvm/usbhotplug/unplug.sh
Executable file
31
configs/kvm/usbhotplug/unplug.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
# sudo virsh attach-device "$1" "$2.xml"
|
||||
|
||||
DOMAIN=$1
|
||||
COMMAND="detach-device"
|
||||
|
||||
#
|
||||
# This is a bit ugly. udev passes us the USB bus number and
|
||||
# device number with leading zeroes. E.g.:
|
||||
# BUSNUM=001 DEVNUM=022
|
||||
# This causes libvirt to assume that the numbers are octal.
|
||||
# To work around this, we need to strip the leading zeroes.
|
||||
# The easiest way is to ask bash to convert the numbers from
|
||||
# base 10:
|
||||
#
|
||||
BUSNUM=$((10#$2))
|
||||
DEVNUM=$((10#$3))
|
||||
|
||||
#
|
||||
# Now we have all the information we need to update the VM.
|
||||
# Run the appropriate virsh-command, and ask it to read the
|
||||
# update XML from stdin.
|
||||
#
|
||||
echo "Running virsh ${COMMAND} ${DOMAIN} for USB bus=${BUSNUM} device=${DEVNUM}:" >&2
|
||||
virsh "${COMMAND}" "${DOMAIN}" /dev/stdin <<END
|
||||
<hostdev mode='subsystem' type='usb'>
|
||||
<source>
|
||||
<address bus='${BUSNUM}' device='${DEVNUM}' />
|
||||
</source>
|
||||
</hostdev>
|
||||
END
|
7
configs/kvm/usbhotplug/usb_bluetooth.xml
Normal file
7
configs/kvm/usbhotplug/usb_bluetooth.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
<vendor id="0x0a12"/>
|
||||
<product id="0x0001"/>
|
||||
</source>
|
||||
<address type="usb" bus="1" port="3"/>
|
||||
</hostdev>
|
Loading…
Reference in a new issue