Restore Samba output to stdout; restore supported Samba protocol #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Address multiple problems which could prevent data from being retrieved
from an AirVisual Pro.
Writing output to
stdout
Prior to this patch the
smbget
command was used with the-O
flagto retrieve data from an AirVisual Pro. Unfortunately, the
-O
flagis not standardized across platforms.
For example, on Ubuntu and Fedora the
-O
flag manages options for theTCP socket used to connect to the device.
On Debian and in the Samba reference implementation the
-O
flag means“write output to standard out”.
Due to these differences, depending on which platform Homebridge is run
under the plugin would or would not work. Removing the
-O
flag simplyinverted the problem (platforms that were working would stop working
because the data was no longer available on
stdout
).The
--stdout
flag does appear to be consistent across platforms. Dueto the SMB protocol issue, however, this issue was resolved by switching
to
smbclient
and issuing a command which usesstdout
as the downloaddestination for the file.
Using a supported SMB protocol
It appears AirVisual Pro devices do not speak SMB protocol versions
2 or 3. Here in December 2024 it also appears Samba only supports SMB
versions 2 or 3 by default.
The Samba reference documentation (for smb.conf) mentions that many
Samba commands support an
--option
flag which can be used to setconfiguration options on a per-connection basis. (I.e. without having
to edit the
smb.conf
file on the running system.)The
smbget
command does appear to support this flag on Ubuntu andFedora but results in an unrecognized-option error on Debian.
To resolve this issue
smbget
is replaced withsmbclient
which doesappear to support the
--option
flag on all (examined) platforms. Thisflag is then used to restore support for the NT1 version of the SMB
protocol which AirVisual Pro devices do appear to support. This solution
avoids requiring the user to make any changes to their Samba
configuration file.