Sometimes resetting a device isn’t as easy as expected. After some research i figured out, that opening a serial connection with a special baud rate would to the job for our Arduino Micro (and similiar like Leonardo):
#!/usr/bin/env python import serial port='/dev/ttyACM0' #adjust this in case your device differs ser = serial.Serial() #open serial connection ser.port=port #setting the port accordingly #in case your usual baudrate isn't 9600 reset will not work, therefore we will open a resetable connection #thanks to mattvenn.net for suggesting to add this step! ser.baudrate=9600 ser.open(); ser.close() ser.baudrate=1200 # set the reset baudrate ser.open(); ser.close() #don't forget to sleep some reset time
Run the script as root. It might need required to change your port according to your serial controller status.