amiga.go 743 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package main
  2. import (
  3. "log"
  4. "os/exec"
  5. "github.com/hypebeast/go-osc/osc"
  6. )
  7. // Your Amiga host!
  8. type Amiga struct {
  9. host string
  10. }
  11. // Reboots your Amiga hardware typically by shorting reset lines on a Gayle
  12. // chip.
  13. func (amiga *Amiga) reset(msg *osc.Message) {
  14. log.Print("Amiga reset triggered at ", amiga.host)
  15. }
  16. // Inserts disk to a machine's df0 floppy drive.
  17. // Typically used to mount adf disk images remotely
  18. // to a flashfloppy emulated drive.
  19. func (amiga *Amiga) insertDisk(msg *osc.Message) {
  20. filename := getOSC[string](msg)
  21. // Find executable
  22. name := "flop"
  23. path, err := exec.LookPath(name)
  24. if err != nil {
  25. log.Printf("can't find '%s'\n", name)
  26. return
  27. }
  28. // run flop command
  29. exec.Command(path, filename).Run()
  30. }