Ah, I see.
You want the system to detect the activation of the device and then run the script automatically when it is plugged in.
Init is the initialization of a service. The init system used by Zorin OS is SystemD
. You can create a systemd service to run your script in response to the tablet being plugged in. In order to detect the tablet being plugged in, you will also need a udev
rule that takes action in response to device events.
You can create a udev rule in /etc/udev/rules.d/
. Name it something that you prefer like 99-tablet.rules
. (So, /etc/udev/rules.d/99-tablet.rules
)
The order the rules are run is determined by the number at the beginning, so I set that number high to ensure it runs after any other rules to prevent any conflicts.
The udev rule needs to have the following:
ACTION=="add", SUBSYSTEM=="usb", ENV{ID_MODEL}=="Gaomon Tablet_PD1220 Pad", RUN+="/path/to/your/script.sh"
I am not sure if the ENV model would be Gaomon Tablet_PD1220 Pad
or just Gaomon Tablet_PD1220
- you can use what appears using lsusb
to determine this.
You can reboot or run sudo udevadm control --reload-rules
to reload the udev rules.
Your systemd service can be created in the directory (Here, again, I will suggest a name but you can use a different one): /etc/systemd/system/tablet-startup.service
Just like above with the udev rule, you will need to replace the /path/to/script.sh/
with the actual path to your script.
It needs to have the unit, service and install fields:
[Unit]
Description=Tablet Startup Service
After=udev.service
[Service]
Type=simple
ExecStart=/bin/bash /path/to/your/script.sh
[Install]
WantedBy=default.target
Reload systemd and enable the service:
sudo systemctl daemon-reload
sudo systemctl enable tablet-setup.service
Hopefully this is enough to get you started though it may need adjustment or troubleshooting.