File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ dot_plugin_if_exists "tio"
158158dot_plugin_if_exists "tz"
159159dot_plugin_if_exists "thokr"
160160dot_plugin_if_exists "unixpermission"
161+ dot_plugin_if_exists "usb"
161162dot_plugin_if_exists "vim"
162163dot_plugin_if_exists "neovim"
163164dot_plugin_if_exists "video"
Original file line number Diff line number Diff line change 1+ # Select and bind a USB device
2+ # Usage: usbip_serve_device
3+ alias usbip_server_device=' f_usbip_start_server '
4+
5+ # Usage: usbip_client_device_connect "129.168.23.2"
6+ alias usbip_client_device_connect=' f_usbip_start_client_connect'
7+
8+ # Usage: usbip_client_device_disconnect ""
9+ alias usbip_client_device_disconnect=' f_usbip_start_client_disconnect'
Original file line number Diff line number Diff line change 1+ function f_usbip_start_client_connect() {
2+ local server_ip=" $1 "
3+
4+ echo " Available USB devices on $server_ip "
5+ usbip list -r " $server_ip "
6+
7+ echo " Which device to bind (eg: 1-1.5) ?"
8+ local dev=" $2 "
9+ read dev
10+
11+ echo " Binding to $dev "
12+ sudo usbip attach -r " $server_ip " -b " $dev "
13+ }
14+
15+ function f_usbip_start_client_disconnect() {
16+ echo " Available USB devices to disconnect"
17+ usbip port
18+
19+ echo " Select port to disconnect"
20+ read port
21+
22+ echo " Unbinding $port locally"
23+ usbip detach -p " $port "
24+
25+ echo " Unbind device remotely"
26+ read busid
27+ usbip unbind -b " $busid "
28+ }
29+
30+ function f_usbip_start_server() {
31+ if is_macos; then
32+ git clone git@github.com:jiegec/usbip.git usbip.git
33+ cd usbip.git
34+ echo " Offering all usb devices"
35+ env RUST_LOG=info cargo run --example host
36+ cd -
37+ if is_linux; then
38+ # List usb devices
39+ usbip list -l
40+ echo " Which device to bind (eg: 1-1.5) ?"
41+ read dev
42+ echo " Binding $dev "
43+ usbip bind -b " $dev "
44+ echo " Press any key to unbind $dev "
45+ read
46+ usbip unbind -b " $dev "
47+ else
48+ echo " ERROR: USB/IP server support missing."
49+ fi
50+ }
You can’t perform that action at this time.
0 commit comments