If the trailer plug wiring follows the normal standards you will find a brake and earth cable based on the standard trailer plug colour chart (don't have it with me right now but the google knows). Use a tester to confirm power to the cable when pressing the brake.