more octopi modifications, cdc_cm and ftdi connects. Are there more?

This commit is contained in:
paukstelis
2021-03-06 13:50:47 -05:00
parent 74ebb57452
commit 58c3e2b389

View File

@@ -115,7 +115,7 @@ if grep -q 'firstRun: true' $BFOLD/config.yaml; then
exit 1 exit 1
fi fi
read -p "Auto-detect printer serial number for udev entry?" -n 1 -r read -p "Begin auto-detect printer serial number for udev entry?" -n 1 -r
echo #new line echo #new line
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
@@ -127,29 +127,31 @@ then
counter=0 counter=0
while [[ -z "$UDEV" ]] && [[ $counter -lt 30 ]]; do while [[ -z "$UDEV" ]] && [[ $counter -lt 30 ]]; do
UDEV=$(timeout 1s journalctl -kf | sed -n -e 's/^.*SerialNumber: //p') UDEV=$(timeout 1s journalctl -kf | sed -n -e 's/^.*SerialNumber: //p')
TEMPUSB=$(timeout 1s journalctl -kf | sed -n -e 's/^.*cdc_acm \(.*\): tty.*/\1/p') TEMPUSB=$(timeout 1s journalctl -kf | sed -n -e 's/^.*\(cdc_acm\|ftdi_sio\) \([0-9].*[0-9]\): \(tty.*\|FTD.*\).*/\2/p')
counter=$(( $counter + 1 )) counter=$(( $counter + 1 ))
done done
if [ -z "$UDEV" ]; then fi
echo "Printer Serial Number not detected"
read -p "Do you want to use the physical USB port to assign the udev entry? If you use this all USB hubs and printers must stay plugged into the same USB positions on your machine as they are right now (y/n)." -n 1 -r if [ -z "$UDEV" ]; then
if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Printer Serial Number not detected"
USB=$TEMPUSB read -p "Do you want to use the physical USB port to assign the udev entry? If you use this all USB hubs and printers must stay plugged into the same USB positions on your machine as they are right now (y/n)." -n 1 -r
echo "Your printer will be setup at the following usb address:" if [[ $REPLY =~ ^[Yy]$ ]]; then
echo $USB USB=$TEMPUSB
echo echo "Your printer will be setup at the following usb address:"
else echo $USB
exit 1 echo
fi
else else
echo "Serial number detected as: $UDEV" exit 1
fi fi
else
echo "Serial number detected as: $UDEV"
fi fi
#Octobuntu cameras #Octobuntu cameras
if [[ $INSTALL = "2" ]]; then if [[ -n $INSTALL ]]; then
read -p "Would you like to auto detect an associated USB camera (experimental)?" -n 1 -r read -p "Would you like to auto detect an associated USB camera (experimental)?" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
@@ -166,7 +168,7 @@ if [[ $INSTALL = "2" ]]; then
done done
if [ -z "$CAM" ]; then if [ -z "$CAM" ]; then
echo "Camera Serial Number not detected" echo "Camera Serial Number not detected"
echo "Your camera should remain at the same USB position and hub. Its position in in udev is $TEMPUSBCAM" echo "Your camera should remain at the same USB position and hub. Its position in udev is $TEMPUSBCAM"
USBCAM=$TEMPUSBCAM USBCAM=$TEMPUSBCAM
else else
echo "Camera detected with serial number: $CAM" echo "Camera detected with serial number: $CAM"
@@ -181,11 +183,11 @@ if [[ $INSTALL = "2" ]]; then
fi fi
CAMPORT=$((CAMPORT+1)) CAMPORT=$((CAMPORT+1))
echo Selected port is: $PORT echo Selected port is: $CAMPORT
fi fi
fi fi
fi fi
echo
read -p "Ready to write all changes. Do you want to proceed? " -n 1 -r read -p "Ready to write all changes. Do you want to proceed? " -n 1 -r
echo echo
if [[ $REPLY =~ ^[Yy]$ ]]; if [[ $REPLY =~ ^[Yy]$ ]];
@@ -214,7 +216,7 @@ then
cat $SCRIPTDIR/octocam_generic.service | \ cat $SCRIPTDIR/octocam_generic.service | \
sed -e "s/OCTOUSER/$OCTOUSER/" \ sed -e "s/OCTOUSER/$OCTOUSER/" \
-e "s/OCTOCAM/cam_$INSTANCE/" \ -e "s/OCTOCAM/cam_$INSTANCE/" \
-e "s/CAMPORT/$CAMPORT/" -e "s/CAMPORT/$CAMPORT/" > /etc/systemd/system/$INSTANCE_cam.service
echo $CAMPORT >> /etc/camera_ports echo $CAMPORT >> /etc/camera_ports
fi fi