-
Notifications
You must be signed in to change notification settings - Fork 0
/
usb.cpp
30 lines (24 loc) · 799 Bytes
/
usb.cpp
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
#include <cstdlib>
#include <string>
#include <filesystem>
#include "usb.h"
void usb_switch_to_device_mode() {
system("/etc/uhubon.sh device");
}
void usb_gadget_add_msc(std::filesystem::path block_dev) {
std::filesystem::path path_absolute = std::filesystem::absolute(block_dev);
system(("./run_usb.sh probe msc '" + path_absolute.string() + "'").c_str());
}
void usb_gadget_add_cdrom(std::filesystem::path iso_path) {
std::filesystem::path path_absolute = std::filesystem::absolute(iso_path);
system(("./run_usb.sh probe cdrom '" + path_absolute.string() + "'").c_str());
}
void usb_gadget_start() {
system("./run_usb.sh start");
}
void usb_gadget_stop() {
system("./run_usb.sh stop");
}
void usb_gadget_add_rndis() {
system("./run_usb.sh probe rndis");
}