Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Secure solution for nexus infrastructure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flg_masters
TM
Secure solution for nexus infrastructure
Commits
e683dcf1
Commit
e683dcf1
authored
2 years ago
by
Florent Gluck
Browse files
Options
Downloads
Patches
Plain Diff
usb-redirection working! Woohoo :-)
parent
66529627
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/exec/QemuSystem.go
+8
-11
8 additions, 11 deletions
src/exec/QemuSystem.go
with
8 additions
and
11 deletions
src/exec/QemuSystem.go
+
8
−
11
View file @
e683dcf1
...
@@ -54,7 +54,7 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
...
@@ -54,7 +54,7 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
if
len
(
usbDevs
)
>
0
{
if
len
(
usbDevs
)
>
0
{
// A qemu-xhci device is required
// A qemu-xhci device is required
usb
=
append
(
usb
,
"-device
qemu-xhci"
)
usb
=
append
(
usb
,
"-device
"
,
"
qemu-xhci"
)
// Generate the USB devices' filter list, for instance:
// Generate the USB devices' filter list, for instance:
// "-1:0x0781:0x5567:-1:1|-1:0x067b:0x2303:-1:1|-1:-1:-1:-1:0"
// "-1:0x0781:0x5567:-1:1|-1:0x067b:0x2303:-1:1|-1:-1:-1:-1:0"
...
@@ -71,10 +71,8 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
...
@@ -71,10 +71,8 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
// Generate QEMU's arguments for the USB devices
// Generate QEMU's arguments for the USB devices
for
i
,
_
:=
range
usbDevs
{
for
i
,
_
:=
range
usbDevs
{
idx
:=
strconv
.
Itoa
(
i
+
1
)
idx
:=
strconv
.
Itoa
(
i
+
1
)
usb
=
append
(
usb
,
"-chardev"
)
usb
=
append
(
usb
,
"-chardev"
,
"spicevmc,name=usbredir,id=usbredir"
+
idx
)
usb
=
append
(
usb
,
"spicevmc,name=usbredir,id=usbredir"
+
idx
)
usb
=
append
(
usb
,
"-device"
,
"usb-redir,filter="
+
filter
.
String
()
+
",chardev=usbredir"
+
idx
)
usb
=
append
(
usb
,
"-device"
)
usb
=
append
(
usb
,
"usb-redir,filter='"
+
filter
.
String
()
+
"',chardev=usbredir"
+
idx
)
}
}
}
}
...
@@ -99,9 +97,8 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
...
@@ -99,9 +97,8 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
// QEMU Guest Agent
// QEMU Guest Agent
args
=
append
(
args
,
"-device"
,
"virtio-serial"
,
"-device"
,
"virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"
,
"-chardev"
,
"socket,path="
+
qgaSock
+
",server=on,wait=off,id=qga0"
)
args
=
append
(
args
,
"-device"
,
"virtio-serial"
,
"-device"
,
"virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"
,
"-chardev"
,
"socket,path="
+
qgaSock
+
",server=on,wait=off,id=qga0"
)
// USB redirection
// USB redirection
for
_
,
u
:=
range
usb
{
args
=
append
(
args
,
usb
...
)
args
=
append
(
args
,
u
)
}
// Sound support
// Sound support
// args = append(args, "-soundhw", "hda")
// args = append(args, "-soundhw", "hda")
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment