-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.go
34 lines (30 loc) · 1011 Bytes
/
version.go
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
// Copyright (c) 2015-2023 The libusb developers. All rights reserved.
// Project site: https://github.com/gotmc/libusb
// Use of this source code is governed by a MIT-style license that
// can be found in the LICENSE.txt file for the project.
package libusb
// #cgo pkg-config: libusb-1.0
// #include <libusb.h>
import "C"
// The VersionType struct represents the libusb version.
type VersionType struct {
Major uint16
Minor uint16
Micro uint16
Nano uint16
ReleaseCandidate string
Describe string
}
// Version gets the libusb version and returns a Version struct.
func Version() VersionType {
cVersion := *C.libusb_get_version()
version := VersionType{
Major: uint16(cVersion.major),
Minor: uint16(cVersion.minor),
Micro: uint16(cVersion.micro),
Nano: uint16(cVersion.nano),
ReleaseCandidate: C.GoString(cVersion.rc),
Describe: C.GoString(cVersion.describe),
}
return version
}