BTW I got this idea because i am using my laptop with Lubuntu and when i insert my usb flash drive the prompt appears.
Code: Select all
sudo nano /usr/local/bin/flash_driveCode: Select all
#!/usr/bin/python
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
for i in range(20):
GPIO.output(18, 1)
sleep(0.1)
GPIO.output(18, 0)
sleep(0.1)Code: Select all
sudo nano /etc/udev/rules.d/71-flash_drive.rulesCode: Select all
ACTION="add", SUBSYSTEMS=="usb", ATTRS{removable}=="removable", RUN+="/usr/local/bin/flash_drive $kernel'"Code: Select all
sudo /etc/init.d/udev