Skip to content

Commit

Permalink
Added linux pc setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
hilary-luo committed Oct 3, 2023
1 parent 61f9519 commit 3e72c61
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spinnaker_camera_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ install(DIRECTORY
DESTINATION share/${PROJECT_NAME}/
)

install(PROGRAMS
scripts/linux_setup_flir.sh
DESTINATION lib/${PROJECT_NAME}
)

if(SPINNAKER_WAS_DOWNLOADED)
set(SPINNAKER_BUILD_SUBDIR "opt/spinnaker/lib")
set(SPINNAKER_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${SPINNAKER_BUILD_SUBDIR}")
Expand Down
31 changes: 31 additions & 0 deletions spinnaker_camera_driver/scripts/linux_setup_flir.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -e

echo ""
echo -e "\e[32mStarting spinnaker_camera_driver setup script\e[0m"
echo ""

sudo addgroup flirimaging
sudo usermod -a -G flirimaging ${USER}

val=$(< /sys/module/usbcore/parameters/usbfs_memory_mb)
if [ "$val" -lt "1000" ]; then
if [ -e /etc/default/grub ]; then
if [ $(grep -c "usbcore.usbfs_memory_mb=1000" /etc/default/grub) -eq 0 ]; then
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& usbcore.usbfs_memory_mb=1000/' /etc/default/grub
echo "Increased the usbfs memory limits in the default grub configuration. Updating grub"
sudo update-grub
else
echo -e "\e[33mWarn: usbfs memory limit is already set in /etc/default/grub. No changes made, try rebooting the computer\e[0m"
fi

else
echo -e "\e[33mWarn: /etc/default/grub configuration file not found, no changes made. usbfs_memory_mb must be set manually. See docs/linux_setup_flir.md for instructions\e[0m"
exit 0
fi
else
echo "usbfs_memory_mb is already set to $val, no changes necessary."
fi

echo -e "\e[32mDone: spinnaker_camera_driver setup script\e[0m"
echo "Please reboot the device to ensure changes have taken full effect"
echo ""

0 comments on commit 3e72c61

Please sign in to comment.