Advertisement
KirboWnz

60-serial.rules

Sep 7th, 2023
1,473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.58 KB | None | 0 0
  1. root@creality / [#] cat /etc/udev/rules.d/60-serial.rules
  2. # do not edit this file, it will be overwritten on update
  3.  
  4. ACTION=="remove", GOTO="serial_remove"
  5. SUBSYSTEM!="tty", GOTO="serial_end"
  6.  
  7. SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}"
  8. SUBSYSTEMS=="pci", IMPORT{builtin}="hwdb --subsystem=pci"
  9. SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
  10.  
  11. # /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
  12. KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end"
  13.  
  14. SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}"
  15.  
  16. # for ai laser
  17. KERNEL=="ttyACM[0-9]*", IMPORT{program}="/usr/bin/cx_ai_crypto $devnode", SYMLINK+="serial/by-id/creality-laser", RUN+="/usr/bin/laser_status.sh"
  18.  
  19. IMPORT{builtin}="path_id"
  20. ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}"
  21. ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}"
  22.  
  23. IMPORT{builtin}="usb_id"
  24. ENV{ID_SERIAL}=="", GOTO="serial_end"
  25. SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}"
  26. ENV{ID_USB_INTERFACE_NUM}=="", GOTO="serial_end"
  27. ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}"
  28. ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}-port$env{.ID_PORT}"
  29.  
  30. GOTO="serial_end"
  31.  
  32. LABEL="serial_remove"
  33.  
  34. KERNEL!="ttyACM[0-9]*", GOTO="serial_end"
  35.  
  36. ENV{DEVLINKS}=="/dev/serial/by-id/creality-laser*", RUN+="/usr/bin/laser_status.sh"
  37.  
  38. LABEL="serial_end"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement