From 83e613ad239459582ae28f78b6c81535b9b138d7 Mon Sep 17 00:00:00 2001
From: Kyle Smith <kyle.smith@acquia.com>
Date: Wed, 14 Dec 2016 23:24:40 -0500
Subject: [PATCH] Allow power consumption to be set per-keyboard.

---
 keyboards/ergodox/ez/config.h       | 2 ++
 tmk_core/protocol/lufa/descriptor.c | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h
index c2750a321..a3dc5bf15 100644
--- a/keyboards/ergodox/ez/config.h
+++ b/keyboards/ergodox/ez/config.h
@@ -56,6 +56,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* Set 0 if debouncing isn't needed */
 #define DEBOUNCE    5
 
+#define USB_MAX_POWER_CONSUMPTION 50
+
 /*
  * Feature disable options
  *  These options are also useful to firmware size reduction.
diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c
index bf47787d2..14d99b50b 100644
--- a/tmk_core/protocol/lufa/descriptor.c
+++ b/tmk_core/protocol/lufa/descriptor.c
@@ -40,6 +40,9 @@
 #include "report.h"
 #include "descriptor.h"
 
+#ifndef USB_MAX_POWER_CONSUMPTION
+#define USB_MAX_POWER_CONSUMPTION 500
+#endif
 
 /*******************************************************************************
  * HID Report Descriptors
@@ -294,7 +297,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 
             .ConfigAttributes       = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_REMOTEWAKEUP),
 
-            .MaxPowerConsumption    = USB_CONFIG_POWER_MA(500)
+            .MaxPowerConsumption    = USB_CONFIG_POWER_MA(USB_MAX_POWER_CONSUMPTION)
         },
 
     /*