Merge pull request 'patch-newfirmware' (#15) from patch-newfirmware into dev

Reviewed-on: #15
This commit is contained in:
Marko Oldenburg 2023-11-17 21:17:50 +01:00
commit d8a46ae3cf
3 changed files with 21 additions and 4 deletions

View File

@ -7,6 +7,7 @@
#
# Special thanks goes to comitters:
# - Vitolinker / Commandref
# - ska- / SSL_startHandshake - SSL Port 3001 Support
#
#
# This script is free software; you can redistribute it and/or modify

View File

@ -1,2 +1,2 @@
UPD 2023-05-16_04:16:05 18968 FHEM/82_LGTV_WebOS.pm
UPD 2023-05-16_04:14:37 55512 lib/FHEM/Devices/LGTV/LGTVWebOS.pm
UPD 2023-11-15_19:19:41 19028 FHEM/82_LGTV_WebOS.pm
UPD 2023-11-17_18:00:13 56133 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -61,6 +61,7 @@ my $missingModul = "";
eval { require MIME::Base64; 1 } or $missingModul .= 'MIME::Base64 ';
eval { require IO::Socket::INET; 1 } or $missingModul .= 'IO::Socket::INET ';
eval { use IO::Socket::SSL; 1 } or $missingModul .= 'IO::Socket::SSL ';
## no critic (Conditional "use" statement. Use "require" to conditionally include a module (Modules::ProhibitConditionalUseStatements))
eval { use Digest::SHA qw /sha1_hex/; 1 } or $missingModul .= 'Digest::SHA ';
@ -648,7 +649,21 @@ sub Open {
::Log3( $name, 4, "LGTV_WebOS ($name) - Baue Socket Verbindung auf" );
my $socket = IO::Socket::INET->new(
# create a connecting socket
# SSL_startHandshake is dependent on the protocol: this lets us use one socket
# to work with either SSL or non-SSL sockets.
my $socket = IO::Socket::SSL->new(
PeerHost => $host,
PeerPort => 3001,
Proto => 'tcp',
SSL_startHandshake => 1, #( $proto eq 'wss' ? 1 : 0 ),
SSL_verify_mode => SSL_VERIFY_NONE,
# Blocking => 1
KeepAlive => 1,
Timeout => $timeout
)
|| IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@ -656,7 +671,8 @@ sub Open {
Timeout => $timeout
)
or return ::Log3( $name, 4,
"LGTV_WebOS ($name) Couldn't connect to $host:$port" ); # open Socket
"LGTV_WebOS ($name) Couldn't connect to $host:$port/3001" )
; # open Socket
$hash->{FD} = $socket->fileno();
$hash->{CD} = $socket; # sysread / close won't work on fileno