Welcome to mirror list, hosted at ThFree Co, Russian Federation.

UsbKernelVersion.cs « Main « LibWinUsb - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b29e7134d362ee56125a2730beca3d2393eda724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright © 2006-2010 Travis Robinson. All rights reserved.
// 
// website: http://sourceforge.net/projects/libusbdotnet
// e-mail:  libusbdotnet@gmail.com
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or 
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
// 
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. or 
// visit www.gnu.org.
// 
// 
using System.Runtime.InteropServices;

namespace LibUsbDotNet.Main
{
    ///<summary>
    /// Contains version information for the LibUsb Sys driver.
    ///</summary>
    /// <remarks>
    /// This version is not related to LibUsbDotNet.  TO get the LibUsbDotNet version use .NET reflections.
    /// </remarks>
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct UsbKernelVersion
    {
        /// <summary>
        /// True if Major == 0 and Minor == 0 and Micro == 0 and Nano == 0.
        /// </summary>
        public bool IsEmpty
        {
            get
            {
                if (Major == 0 && Minor == 0 && Micro == 0 && Nano == 0) return true;
                return false;
            }
        }

        internal UsbKernelVersion(int major, int minor, int micro, int nano, int bcdLibUsbDotNetKernelMod)
        {
            Major = major;
            Minor = minor;
            Micro = micro;
            Nano = nano;
            BcdLibUsbDotNetKernelMod = bcdLibUsbDotNetKernelMod;
        }

        /// <summary>
        /// LibUsb-Win32 Major version
        /// </summary>
        public readonly int Major;

        /// <summary>
        /// LibUsb-Win32 Minor version
        /// </summary>
        public readonly int Minor;

        /// <summary>
        /// LibUsb-Win32 Micro version
        /// </summary>
        public readonly int Micro;

        /// <summary>
        /// LibUsb-Win32 Nano version
        /// </summary>
        public readonly int Nano;

        /// <summary>
        /// The LibUsbDotNet - LibUsb-Win32 binary mod code. if not running the LibUsbDotNet LibUsb-Win32 modified kernel driver, this value is 0.
        /// </summary>
        public readonly int BcdLibUsbDotNetKernelMod;


        ///<summary>
        ///The full LibUsb-Win32 kernel driver version (libusb0.sys).
        ///</summary>
        ///
        ///<returns>
        ///A <see cref="System.String"/> containing the full LibUsb-Win32 version.
        ///</returns>
        public override string ToString() { return string.Format("{0}.{1}.{2}.{3}", Major, Minor, Micro, Nano); }
    }
}