udev-usb-sync/99-usb-sync.rules

47 lines
2.4 KiB
Text
Raw Normal View History

2024-08-27 11:15:49 +02:00
# This rules file is part of udev-usb-sync package
#
# MIT License
#
# Copyright (c) 2023 Frede Hundewadt (@linux-aarhus)
#
# Permission is hereby granted, free of charge,to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# @linux-aarhus - root.nix.dk
#
2024-09-12 08:27:39 +02:00
# configuration : /etc/usb-dev-sync/udev-usb-sync.conf
# trigger script: /usr/bin/udev-usb-sync
2024-08-27 11:15:49 +02:00
#
# contributors: @megavolt (Manjaro Forum)
# : @linux-aarhus (Manjaro Forum)
# inspired by : @kwg (EndeavourOS Forum)
2024-09-13 17:31:48 +02:00
KERNEL!="sd[a-z]|sd[a-z][0-9]", GOTO="usb_limit_write_cache_end"
ENV{ID_USB_TYPE}!="disk", GOTO="usb_limit_write_cache_end"
ACTION!="add|change", GOTO="usb_limit_write_cache_end"
2024-08-27 11:15:49 +02:00
2024-09-13 17:31:48 +02:00
PROGRAM+="/usr/bin/uname -r"
2024-09-13 17:31:48 +02:00
RESULT=="4*|5*|6.1.*", ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_MOUNT_OPTIONS_DEFAULTS}+="sync", ENV{UDISKS_MOUNT_OPTIONS_ALLOW}+="sync", GOTO="usb_limit_write_cache_end"
RESULT!="4*|5*|6.1.*", ATTRS{bDeviceClass}!="09", ATTRS{speed}=="10000", RUN+="/usr/bin/udev-usb-sync %k %s{speed}", GOTO="usb_limit_write_cache_end"
RESULT!="4*|5*|6.1.*", ATTRS{bDeviceClass}!="09", ATTRS{speed}=="5000", RUN+="/usr/bin/udev-usb-sync %k %s{speed}", GOTO="usb_limit_write_cache_end"
RESULT!="4*|5*|6.1.*", ATTRS{bDeviceClass}!="09", ATTRS{speed}=="480", RUN+="/usr/bin/udev-usb-sync %k %s{speed}", GOTO="usb_limit_write_cache_end"
RESULT!="4*|5*|6.1.*", ATTRS{bDeviceClass}!="09", ATTRS{speed}=="12", RUN+="/usr/bin/udev-usb-sync %k %s{speed}", GOTO="usb_limit_write_cache_end"
LABEL="usb_limit_write_cache_end"