Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95866f7df0 | ||
|
|
aaa949cc2a | ||
|
|
ed2b7b7cb9 |
@@ -1,6 +1,6 @@
|
||||
export DEBUG=1
|
||||
export DEBUG=true
|
||||
export RAW_UDP=17070
|
||||
export BUTTON_PARSER_V01=true
|
||||
export WRAP_REFRESH_ON_SIGUSR1=true
|
||||
export WRAP_REMAP_FILE=./config.d/mayhem-party.d/remap.d/live.yaml
|
||||
export MAIN_INTERVAL_DURATION=5ms
|
||||
export OUTPUT_KEYBOARD=false
|
||||
|
||||
@@ -4,21 +4,23 @@ streams:
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: bel
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "!", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: '1'
|
||||
down: '2'
|
||||
left: '3'
|
||||
right: '4'
|
||||
l: '5'
|
||||
r: '6'
|
||||
a: '7'
|
||||
b: '8'
|
||||
x: '9'
|
||||
y: '0'
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: false
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
|
||||
@@ -4,21 +4,23 @@ streams:
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: zach
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "!", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: 'q'
|
||||
down: 'w'
|
||||
left: 'e'
|
||||
right: 'r'
|
||||
l: 't'
|
||||
r: 'y'
|
||||
a: 'u'
|
||||
b: 'i'
|
||||
x: 'o'
|
||||
y: 'p'
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: false
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
|
||||
@@ -4,21 +4,23 @@ streams:
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: mason
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "!", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: 'a'
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'd'
|
||||
right: 'f'
|
||||
l: 'g'
|
||||
r: 'h'
|
||||
a: 'j'
|
||||
b: 'k'
|
||||
x: 'l'
|
||||
y: ';'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: false
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
|
||||
@@ -4,21 +4,23 @@ streams:
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: nat
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "!", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: 'z'
|
||||
down: 'x'
|
||||
left: 'c'
|
||||
right: 'v'
|
||||
l: 'b'
|
||||
r: 'n'
|
||||
a: 'm'
|
||||
b: ','
|
||||
x: '-'
|
||||
y: '/'
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: false
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
|
||||
@@ -4,21 +4,23 @@ streams:
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: roxy
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "!", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: '!'
|
||||
down: '@'
|
||||
left: '#'
|
||||
right: '$'
|
||||
l: '%'
|
||||
r: '^'
|
||||
a: '&'
|
||||
b: '*'
|
||||
x: '('
|
||||
y: ')'
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: false
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
|
||||
28
host.d/config.d/rusty-pipe.d/6.yaml
Normal file
28
host.d/config.d/rusty-pipe.d/6.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
streams:
|
||||
input:
|
||||
debug: false
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: chase
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
host: mayhem-party.home.blapointe.com
|
||||
port: 17070
|
||||
28
host.d/config.d/rusty-pipe.d/7.yaml
Normal file
28
host.d/config.d/rusty-pipe.d/7.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
streams:
|
||||
input:
|
||||
debug: false
|
||||
engine:
|
||||
name: gui
|
||||
gui:
|
||||
user: bill
|
||||
press: {prefix: "", suffix: ""}
|
||||
release: {prefix: "", suffix: ""}
|
||||
format: '{"T":{{ms}},"U":"{{user}}","Y":"{{pressed}}","N":"{{released}}"}'
|
||||
buttons:
|
||||
up: 'w'
|
||||
down: 's'
|
||||
left: 'a'
|
||||
right: 'd'
|
||||
l: 'e'
|
||||
r: 'q'
|
||||
a: '1'
|
||||
b: '2'
|
||||
x: '3'
|
||||
y: '4'
|
||||
output:
|
||||
debug: true
|
||||
engine:
|
||||
name: udp
|
||||
udp:
|
||||
host: mayhem-party.home.blapointe.com
|
||||
port: 17070
|
||||
@@ -12,8 +12,8 @@ type Parser interface {
|
||||
}
|
||||
|
||||
func New(ctx context.Context, src raw.Raw) Parser {
|
||||
if os.Getenv("BUTTON_PARSER_V1") == "true" {
|
||||
return NewV1(src)
|
||||
if os.Getenv("BUTTON_PARSER_V01") == "true" {
|
||||
return NewV01(src)
|
||||
}
|
||||
return NewPlaintext(src)
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
func TestParser(t *testing.T) {
|
||||
var _ button.Parser = button.Plaintext{}
|
||||
var _ button.Parser = button.V1{}
|
||||
var _ button.Parser = button.V01{}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
var debugging = os.Getenv("DEBUG") == "true"
|
||||
|
||||
type (
|
||||
V1 struct {
|
||||
V01 struct {
|
||||
src raw.Raw
|
||||
}
|
||||
v1Msg struct {
|
||||
v01Msg struct {
|
||||
T int64
|
||||
U string
|
||||
Y string
|
||||
@@ -21,26 +21,26 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func NewV1(src raw.Raw) V1 {
|
||||
return V1{
|
||||
func NewV01(src raw.Raw) V01 {
|
||||
return V01{
|
||||
src: src,
|
||||
}
|
||||
}
|
||||
|
||||
func (v1 V1) Close() {
|
||||
v1.src.Close()
|
||||
func (v01 V01) Close() {
|
||||
v01.src.Close()
|
||||
}
|
||||
|
||||
func (v1 V1) Read() []Button {
|
||||
line := v1.src.Read()
|
||||
var msg v1Msg
|
||||
func (v01 V01) Read() []Button {
|
||||
line := v01.src.Read()
|
||||
var msg v01Msg
|
||||
if err := json.Unmarshal(line, &msg); err != nil {
|
||||
log.Printf("%v: %s", err, line)
|
||||
}
|
||||
return msg.buttons()
|
||||
}
|
||||
|
||||
func (msg v1Msg) buttons() []Button {
|
||||
func (msg v01Msg) buttons() []Button {
|
||||
buttons := make([]Button, len(msg.Y)+len(msg.N))
|
||||
for i := range msg.Y {
|
||||
buttons[i] = Button{Char: msg.Y[i], Down: true}
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestV1(t *testing.T) {
|
||||
func TestV01(t *testing.T) {
|
||||
src := constSrc(`{"T":1,"U":"bel","Y":"abc","N":"cde"}`)
|
||||
t.Logf("(%v) %s", len(src), src.Read())
|
||||
v1 := button.NewV1(src)
|
||||
got := v1.Read()
|
||||
v01 := button.NewV01(src)
|
||||
got := v01.Read()
|
||||
want := []button.Button{
|
||||
{Down: true, Char: 'a'},
|
||||
{Down: true, Char: 'b'},
|
||||
Reference in New Issue
Block a user