Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix common USB matching options for bcmxcp_usb #2270

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
tripplite_usb_SOURCES = tripplite_usb.c $(LIBUSB_IMPL) usb-common.c
tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm

bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c
bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c $(LIBUSB_IMPL) usb-common.c
bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm

blazer_usb_SOURCES = blazer.c blazer_usb.c $(LIBUSB_IMPL) usb-common.c
Expand Down
6 changes: 4 additions & 2 deletions drivers/bcmxcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2213,8 +2213,10 @@ void upsdrv_help(void)
{
}

/* list flags and values that you want to receive via -x */
void upsdrv_makevartable(void)
/* list flags and values that you want to receive via -x
* or ups.conf to all bcmxcp* family of drivers
*/
void bcmxcp_makevartable(void)
{
addvar(VAR_VALUE, "shutdown_delay", "Specify shutdown delay (seconds)");
addvar(VAR_VALUE, "baud_rate", "Specify communication speed (ex: 9600)");
Expand Down
2 changes: 2 additions & 0 deletions drivers/bcmxcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,4 +622,6 @@ typedef enum ebool { FALSE, TRUE } bool_t;
typedef int bool_t;
#endif

void bcmxcp_makevartable(void);

#endif /* NUT_BCMXCP_H_SEEN */
5 changes: 5 additions & 0 deletions drivers/bcmxcp_ser.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,11 @@ static void pw_comm_setup(const char *port)
# pragma GCC diagnostic pop
#endif

void upsdrv_makevartable(void)
{
bcmxcp_makevartable();
}

void upsdrv_initups(void)
{
upsfd = ser_open(device_path);
Expand Down
11 changes: 10 additions & 1 deletion drivers/bcmxcp_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "bcmxcp.h"
#include "bcmxcp_io.h"
#include "common.h"
#include "nut_libusb.h"
#include "usb-common.h"
#include "timehead.h"
#include "nut_stdint.h" /* for uint16_t */
Expand All @@ -11,7 +12,7 @@
#include <unistd.h>

#define SUBDRIVER_NAME "USB communication subdriver"
#define SUBDRIVER_VERSION "0.27"
#define SUBDRIVER_VERSION "0.28"

/* communication driver description structure */
upsdrv_info_t comm_upsdrv_info = {
Expand Down Expand Up @@ -367,6 +368,14 @@ void upsdrv_comm_good(void)
nutusb_comm_good();
}

void upsdrv_makevartable(void)
{
bcmxcp_makevartable();

/* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */
nut_usb_addvars();
}

void upsdrv_initups(void)
{
upsdev = nutusb_open("USB");
Expand Down
5 changes: 4 additions & 1 deletion tools/nut-scanner/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ LINKED_SOURCE_FILES += serial.c
serial.c: $(top_srcdir)/drivers/serial.c
test -s "$@" || ln -s -f "$(top_srcdir)/drivers/serial.c" "$@"

LINKED_SOURCE_FILES += bcmxcp_ser.c
LINKED_SOURCE_FILES += bcmxcp_ser.c bcmxcp.c
bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c
test -s "$@" || ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@"

bcmxcp.c: $(top_srcdir)/drivers/bcmxcp.c
test -s "$@" || ln -s -f "$(top_srcdir)/drivers/bcmxcp.c" "$@"

CLEANFILES += $(LINKED_SOURCE_FILES)
BUILT_SOURCES += $(LINKED_SOURCE_FILES)

Expand Down
Loading