McKael / samtv

samtvcli -- Network CLI remote for Samsung TVs (models 2014-2015)
https://lilotux.net/~mikael/pub/samtv/
MIT License
38 stars 4 forks source link

Compilation Raspberry #1

Closed zoipod closed 5 years ago

zoipod commented 5 years ago

Hello, I want to use your app on my raspberry, to connect with my domotic app. When I compile source code, I receive an error : $ go build github.com/McKael/samtv/cmd ../../src/github.com/McKael/samtv/cmd/tui_keybindings.go:95: undefined: strings.Builder

My version of go : $ go version go version go1.7.4 linux/arm

Have you a solution to compile with this version ? (I know go since yesterday ^^)

Thx

McKael commented 5 years ago

Is it acceptable for you to use a newer compiler? (strings.Builder was introduced in Go v1.10 AFAICT...)

For example, you can download a copy of go 1.11 and use it with:

$ go get golang.org/dl/go1.11
$ go1.11 download

... and then use:

$ go1.11 build

to build this project.

McKael commented 5 years ago

(BTW a prebuilt binary is available in the release files)

zoipod commented 5 years ago

Well, it's ok with this version of Go. Thx you.

When I send key, it's ok on TV, but I receive an error.

$ samtvcli key KEY_VOLUP
INFO[0000] Using config file: /home/pi/.config/samtvcli/samtvcli.yaml 
ERRO[0004] Cannot send key 'KEY_VOLUP': incorrect TV reply 

Reply it's not important, because it works, but I think, I can't send multi key.

$ samtvcli key KEY_SOURCE _ KEY_RIGHT
INFO[0000] Using config file: /home/pi/.config/samtvcli/samtvcli.yaml 
ERRO[0006] Cannot send key 'KEY_SOURCE': incorrect TV reply 

key "KEY_RIGHT" is not send, surely due to this error..

Have you an idea ?

McKael commented 5 years ago

@zoipod No, I don't have an idea... I don't get this with my own TV.

Can you send me the debug output?

samtvcli --debug key KEY_VOLUP

In the mean time, since it works for you I could also add something like a --ignore-result flag, maybe?

zoipod commented 5 years ago

@McKael Hi, this is the debug mode :

$ samtvcli key KEY_SOURCE _ KEY_RIGHT --debug
INFO[0000] Using config file: /home/pi/.config/samtvcli/samtvcli.yaml 
DEBU[0000] Fetch URL: http://192.168.1.33:8000/socket.io/1/?t=1541753905137 
DEBU[0006] Reading WS message...                        
DEBU[0006] Read message (type 1): `1::`                 
DEBU[0006] Got greetings from TV                        
DEBU[0006] Sending SmartView handshake...               
DEBU[0006] Sending WS message: `1::/com.samsung.companion` ... 
DEBU[0006] Reading WS message...                        
DEBU[0006] Read message (type 1): `1::/com.samsung.companion` 
DEBU[0006] SmartView handshake completed                
DEBU[0006] Reading WS message...                        
DEBU[0006] sendMessage('KEY_SOURCE')                    
DEBU[0006] Sending WS message: `5::/com.samsung.companion:{"name":"callCommon","args":[{"Session_Id":1,"body":"[240, 192, 61, 145, 49, 191, 198, 19, 239, 224, 15, 240, 169, 114, 196, 69, 26, 151, 145, 90, 136, 142, 238, 57, 34, 236, 88, 233, 27, 14, 108, 207, 226, 211, 231, 66, 12, 56, 241, 145, 45, 203, 59, 92, 29, 1, 2, 137, 15, 84, 243, 82, 137, 163, 130, 107, 207, 192, 178, 55, 149, 143, 169, 165, 47, 220, 140, 157, 161, 12, 205, 22, 80, 150, 116, 205, 55, 213, 40, 15, 178, 157, 86, 222, 229, 67, 195, 16, 42, 94, 141, 210, 103, 44, 60, 19, 9, 122, 213, 246, 164, 8, 234, 80, 69, 157, 18, 106, 241, 219, 140, 142, 17, 181, 187, 23, 64, 204, 244, 57, 192, 28, 148, 154, 9, 20, 127, 60, 191, 252, 143, 182, 7, 135, 119, 205, 74, 54, 103, 158, 26, 66, 122, 144, 100, 20, 13, 222, 231, 154, 1, 57, 172, 91, 59, 143, 70, 51, 139, 150, 120, 122, 53, 96, 27, 121, 254, 198, 240, 174, 183, 64, 238, 227, 161, 115]"}]}` ... 
DEBU[0007] Read message (type 1): `5::/com.samsung.companion:{"name":"receiveCommon","args":"[22,207,41,186,127,190,110,24,15,221,68,194,2,108,106,213,229,116,154,221,71,188,133,56,111,129,181,36,171,81,178,30,108,250,133,11,229,54,165,20,21,67,226,211,182,23,80,150,71,89,168,243,64,88,71,212,193,148,202,190,56,71,5,160]"}` 
DEBU[0007] SmartView message received                   
DEBU[0007] data: 22726573756c74223a2231227d030303       
DEBU[0007] padlen: 03                                   
DEBU[0007] plain text: []byte{0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x22, 0x31, 0x22, 0x7d} 
DEBU[0007] Successfully decrypted response: [34 114 101 115 117 108 116 34 58 34 49 34 125] 
DEBU[0007] SmartView message: "result":"1"}             
DEBU[0007] Reading WS message...                        
DEBU[0007] TV message: `"result":"1"}`                  
ERRO[0007] Cannot send key 'KEY_SOURCE': incorrect TV reply 

I just found key KEY_HDMI, so I can change source with it.

Last question, if I power off the TV, I have to pair to get a new session ? Or the first paring is definitive ?

McKael commented 5 years ago

Thanks for the trace, I'll push a fix!

With my TV, the pairing is lost when the TV is completely powered off or rebooted, but it stays paired when using the usual stand-by mode.

McKael commented 5 years ago

@zoipod Hopefully this should be fixed now.

zoipod commented 5 years ago

Just perfect ! Thank you

McKael commented 5 years ago

Great, thanks!