VirtualBox

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

Last change on this file since 51612 was 44529, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.4 KB
Line 
1#! /bin/sh
2# $Id: VBoxCreateUSBNode.sh 44529 2013-02-04 15:54:15Z 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-2011 Oracle Corporation
10#
11# This file is part of VirtualBox Open Source Edition (OSE), as
12# available from http://www.virtualbox.org. This file is free software;
13# you can redistribute it and/or modify it under the terms of the GNU
14# General Public License (GPL) as published by the Free Software
15# Foundation, in version 2 as it comes in the "COPYING" file of the
16# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18#
19
20# Constant, from the USB specifications
21usb_class_hub=09
22
23do_remove=0
24case "$1" in "--remove")
25 do_remove=1; shift;;
26esac
27bus=`expr "$2" '/' 128 + 1`
28device=`expr "$2" '%' 128 + 1`
29class="$3"
30group="$4"
31devdir="`printf "/dev/vboxusb/%.3d" $bus`"
32devpath="`printf "/dev/vboxusb/%.3d/%.3d" $bus $device`"
33case "$do_remove" in
34 0)
35 if test -n "$class" -a "$class" -eq "$usb_class_hub"
36 then
37 exit 0
38 fi
39 case "$group" in "") group="vboxusers";; esac
40 mkdir /dev/vboxusb -m 0750 2>/dev/null
41 chown root:$group /dev/vboxusb 2>/dev/null
42 mkdir "$devdir" -m 0750 2>/dev/null
43 chown root:$group "$devdir" 2>/dev/null
44 mknod "$devpath" c $1 $2 -m 0660 2>/dev/null
45 chown root:$group "$devpath" 2>/dev/null
46 ;;
47 1)
48 rm -f "$devpath"
49 ;;
50esac
51
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