VirtualBox

source: vbox/trunk/src/VBox/Installer/linux/VBoxCreateUSBNode.sh@ 107044

Last change on this file since 107044 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1#! /bin/sh
2# $Id: VBoxCreateUSBNode.sh 106061 2024-09-16 14:03:52Z vboxsync $ */
3## @file
4# VirtualBox USB Proxy Service, Linux Specialization.
5# udev helper for creating and removing device nodes for VirtualBox USB devices
6#
7
8#
9# Copyright (C) 2010-2024 Oracle and/or its affiliates.
10#
11# This file is part of VirtualBox base platform packages, as
12# available from https://www.virtualbox.org.
13#
14# This program is free software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License
16# as published by the Free Software Foundation, in version 3 of the
17# License.
18#
19# This program is distributed in the hope that it will be useful, but
20# WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22# General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with this program; if not, see <https://www.gnu.org/licenses>.
26#
27# SPDX-License-Identifier: GPL-3.0-only
28#
29
30# Constant, from the USB specifications
31usb_class_hub=09
32
33do_remove=0
34case "$1" in "--remove")
35 do_remove=1; shift;;
36esac
37bus=`expr "$2" '/' 128 + 1`
38device=`expr "$2" '%' 128 + 1`
39class="$3"
40group="$4"
41devdir="`printf "/dev/vboxusb/%.3d" $bus`"
42devpath="`printf "/dev/vboxusb/%.3d/%.3d" $bus $device`"
43case "$do_remove" in
44 0)
45 if test -n "$class" -a "$class" = "$usb_class_hub"
46 then
47 exit 0
48 fi
49 case "$group" in "") group="vboxusers";; esac
50 mkdir /dev/vboxusb -m 0750 2>/dev/null
51 chown root:$group /dev/vboxusb 2>/dev/null
52 mkdir "$devdir" -m 0750 2>/dev/null
53 chown root:$group "$devdir" 2>/dev/null
54 mknod "$devpath" c $1 $2 -m 0660 2>/dev/null
55 chown root:$group "$devpath" 2>/dev/null
56 ;;
57 1)
58 rm -f "$devpath"
59 ;;
60esac
61
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette