added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,4 @@
ACTION=="remove", SUBSYSTEM=="usb", RUN+="/usr/sbin/stm32mp-usbip-bind-unbind.sh remove %p"
ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", RUN+="/usr/sbin/stm32mp-usbip-bind-unbind.sh add %p"

View File

@@ -0,0 +1,45 @@
USB IP:
------
REF:
https://developer.ridgerun.com/wiki/index.php?title=How_to_setup_and_use_USB/IP
Server configuration:
---------------------
The package usbip provide the tools and service to enable a serveur for usbip.
To enable it on server:
$> systemctl enable usbip
$> systemctl start usbip
Client configuration and way of working (Linux ubuntu PC):
----------------------------------------------------------
Pre-requisite on ubuntu:
sudo apt-get install sysfsutils libwrap0-dev libglib2.0-dev libtool automake autoconf pkg-config linux-tools-generic
Download ids file and install it:
wget http://www.linux-usb.org/usb.ids
sudo mkdir -p /usr/share/hwdata/
sudo cp usb.ids /usr/share/hwdata/
Setup:
sudo modprobe usbip-core
sudo modprobe vhci-hcd
Can be automaticaly load at runtime by putting it on module load:
echo "usbip-core" > /etc/modules-load.d/usbip.conf
echo "vhci-hcd" >> /etc/modules-load.d/usbip.conf
List usb remote available on specific server:
sudo usbip list -r <server IP>
attach an USB:
sudo usbip attach -r <server IP> -b <USB ID>
Detach
sudo usbip port
sudo usbip detach -p 00
NOTE: if "usbip attach" return an error like:
"usbip: info: no exportable devices found on 10.48.0.144"
That meanin there is no usb device plugged on server.

View File

@@ -0,0 +1,41 @@
#!/bin/sh -
#echo "Parameter number $#" >> /tmp/usbip.log
action=$1
devpath=$2
#echo "Parameter: $1" >> /tmp/usbip.log
#echo "Parameter: $2" >> /tmp/usbip.log
case $1 in
unload)
modprobe -r usbip-core
modprobe -r usbip-host
kill -9 `pgrep usbipd`
exit 0
;;
esac
subpath=$(echo $2 | sed "s|.*/\([^/]*\)|\1|")
#echo "subpath >$subpath<" >> /tmp/usbip.log
if $(echo $subpath | grep -q ":");
then
#echo "No valid path" >> /tmp/usbip.log
exit 0
fi
# if usbip-core are not loaded, do nothing
if [ -z "$(cat /proc/modules | grep usbip_core)" ]; then
#echo "no module usbip_core loaded" >> /tmp/usbip.log
exit 0
fi
case $1 in
add)
#echo ">>> bind $subpath" >> /tmp/usbip.log
usbip bind -b $subpath
;;
remove)
#echo "<<< unbind $subpath" >> /tmp/usbip.log
usbip unbind -b $subpath
;;
esac

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
blacklist usbip-core
blacklist usbip-host

View File

@@ -0,0 +1,15 @@
[Unit]
Description=USB-IP Bindind
After=network.target
Wants=network.target
[Service]
Type=forking
ExecStartPre=-/sbin/modprobe usbip-core
ExecStartPre=-/sbin/modprobe usbip-host
ExecStart=/usr/sbin/usbipd -D
ExecStop=/usr/sbin/stm32mp-usbip-bind-unbind.sh unload
[Install]
WantedBy=multi-user.target