-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
63 lines (59 loc) · 1.23 KB
/
main.go
File metadata and controls
63 lines (59 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"github.com/lucaber/deckjoy/pkg/bluetooth"
"github.com/lucaber/deckjoy/pkg/cmd"
"github.com/lucaber/deckjoy/pkg/hid"
"github.com/lucaber/deckjoy/pkg/usb"
"github.com/urfave/cli/v2"
log "github.com/sirupsen/logrus"
"os"
"runtime"
)
func main() {
runtime.LockOSThread()
app := &cli.App{
Commands: []*cli.Command{
{
Name: "daemon",
Usage: "daemon to configure the steam deck; start with root permissions",
Action: cmd.RunDaemon,
},
{
Name: "cleanup",
Usage: "remove usb gadget",
Action: func(*cli.Context) error {
deckUSB, err := usb.NewUSB()
if err != nil {
return err
}
err = deckUSB.Destroy()
if err != nil {
return err
}
return nil
},
},
{
Name: "gui",
Usage: "show gui",
Action: cmd.RunGui,
},
{
Name: "test",
Usage: "test",
Action: func(context *cli.Context) error {
log.SetLevel(log.DebugLevel)
err := bluetooth.NewBluetooth().Run(context.Context, bluetooth.SDPRecord{HIDDescriptor: hid.KeyboardReportDesc})
if err != nil {
return err
}
select {}
},
},
},
Action: cmd.RunGui,
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}