1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
Description: Apply the legousbtower
Author: Michael Wales <mwales3@gmail.com>
Forwarded: no
Reviewed-By: Petter Reinholdtsen <pere@debian.org>
Last-Update: 2021-09-29
--- a/Makefile
+++ b/Makefile
@@ -86,7 +86,7 @@
ifneq (,$(strip $(findstring $(OSTYPE), Linux)))
# Linux
# uncomment this next line if you have the USB tower library installed
-# USBOBJ = rcxlib/RCX_USBTowerPipe_linux.o
+ USBOBJ = rcxlib/RCX_USBTowerPipe_linux.o
CFLAGS += -I/usr/local/include/LegoUSB -Wno-deprecated
else
ifneq (,$(findstring $(OSTYPE), SunOS))
--- /dev/null
+++ b/rcxlib/legousbtower.h
@@ -0,0 +1,52 @@
+/*
+ * legousbtower Lego USB IR Tower Linux Driver
+ *
+ * Copyright (c) 2001-2002 The LegoUSB DevTeam <legousb-devteam@lists.sourceforge.net>
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ */
+
+#ifndef __LEGOUSBTOWER_H
+#define __LEGOUSBTOWER_H
+
+#define LEGO_TOWER_SET_PARAM _IOW('u', 0xb0, int)
+#define LEGO_TOWER_GET_PARAM _IOW('u', 0xb1, int)
+#define LEGO_TOWER_RESET _IO('u', 0xb3)
+
+
+#define LEGO_TOWER_SET_READ_TIMEOUT _IOW('u', 0xc8, int)
+#define LEGO_TOWER_SET_WRITE_TIMEOUT _IOW('u', 0xc9, int)
+
+
+#define LEGO_USB_TOWER_REQUEST_GET 1
+#define LEGO_USB_TOWER_REQUEST_SET 2
+#define LEGO_USB_TOWER_REQUEST_RESET 4
+
+
+#define LEGO_USB_TOWER_ADDRESS_MODE 1
+#define LEGO_USB_TOWER_ADDRESS_POWER_LEVEL 2
+
+#define LEGO_USB_TOWER_POWER_LEVEL_LOW 1
+#define LEGO_USB_TOWER_POWER_LEVEL_MEDIUM 2
+#define LEGO_USB_TOWER_POWER_LEVEL_HIGH 3
+
+#define LEGO_USB_TOWER_MODE_VLL 1
+#define LEGO_USB_TOWER_MODE_RCX 2
+
+
+
+struct request_reply
+{
+ unsigned short length;
+ unsigned char error_code;
+ unsigned char value;
+ unsigned char buffer[16]; // variable replies from the tower
+ // at this stage we aren't interested in the data
+};
+
+#endif
--- a/rcxlib/RCX_USBTowerPipe_linux.cpp
+++ b/rcxlib/RCX_USBTowerPipe_linux.cpp
@@ -29,7 +29,7 @@
#include <sys/ioctl.h>
#include "RCX_Pipe.h"
-#include <LegoUSB/legousbtower.h>
+#include "legousbtower.h"
class RCX_USBTowerPipe_linux : public RCX_Pipe
@@ -59,7 +59,7 @@
return new RCX_USBTowerPipe_linux();
}
-#define DEFAULT_TOWER_NAME "/dev/usb/lego0"
+#define DEFAULT_TOWER_NAME "/dev/usb/legousbtower0"
RCX_Result RCX_USBTowerPipe_linux::Open(const char *name, int mode)
{
|