StephenBlackWasAlreadyTaken / wixel-xDrip

Allow a wixel to function as Dexcom Reciever
Other
47 stars 117 forks source link

Compile Issue #52

Closed aweebs closed 6 years ago

aweebs commented 7 years ago

I'm getting compiler errors when using the makefile on Ubuntu 16.04 LTS. The code is the latest from the master branch as of February 12, 2017.

make error:

Compiling libraries/src/usb/usb.rel
libraries/src/usb/usb.c:292: error 146: two or more storage classes in declaration for 'usbStandardDeviceRequestHandler'
Makefile:172: recipe for target 'libraries/src/usb/usb.rel' failed
make: *** [libraries/src/usb/usb.rel] Error 1

SDCC -v output (in case it's useful):

SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/TININative/ds400/hc08/s08/stm8 3.5.0 #9253 (Mar 24 2016) (Linux)
published under GNU General Public License (GPL)
Entropy512 commented 7 years ago

Same issue here. Will try and look into it later this week in more detail.

Entropy512 commented 7 years ago

May be related to https://github.com/StephenBlackWasAlreadyTaken/wixel-xDrip/pull/49

mbc1855 commented 7 years ago

Is there a solution to this?

jareware commented 6 years ago

Having the same issue.

jareware commented 6 years ago

A quick fix on top of current master (at a15cd96a):

--- a/libraries/src/usb/usb.c
+++ b/libraries/src/usb/usb.c
@@ -8,7 +8,7 @@

 extern uint8 CODE usbConfigurationDescriptor[];

-void usbStandardDeviceRequestHandler();
+static void usbStandardDeviceRequestHandler();

 #define CONTROL_TRANSFER_STATE_NONE  0
 #define CONTROL_TRANSFER_STATE_WRITE 1
@@ -223,6 +223,12 @@ void usbPoll()

                 USBINDEX = 0;  // Select EP0 again because the functions above might have changed USBINDEX.

+                // Modify the count so that we don't send more data than the host requested.
+                if(controlTransferBytesLeft > usbSetupPacket.wLength)
+                {
+                    controlTransferBytesLeft = usbSetupPacket.wLength;
+                }
+
                 // Prepare for the first transaction after the SETUP packet.
                 if (controlTransferState == CONTROL_TRANSFER_STATE_NONE)
                 {
@@ -336,7 +342,11 @@ static void usbStandardDeviceRequestHandler()
                 {
                     if ((usbSetupPacket.wValue & 0xFF) >= usbStringDescriptorCount)
                     {
-                        // Invalid string index.
+                        // This is either an invalid string index or it is 0xEE,
+                        // which is defined by Microsoft OS Descriptors 1.0.
+                        // This library provides no features for handling such requests,
+                        // but we call the user's callback in case they want to.
+                        usbCallbackClassDescriptorHandler();
                         return;
                     }

@@ -358,14 +368,6 @@ static void usbStandardDeviceRequestHandler()
                 }
             }

-            // Modify the count so that we don't send more data than the host requested.
-            // We MUST use the local variable wLength instead of usbSetupPacket.wLength because
-            // USB_SETUP_PACKET may have been over-written by the serial number handler.
-            if(controlTransferBytesLeft > usbSetupPacket.wLength)
-            {
-                controlTransferBytesLeft = usbSetupPacket.wLength;
-            }
-
             controlTransferState = CONTROL_TRANSFER_STATE_READ;
             return;
         }

This is the result of updating the usb.c dep from the latest wixel-SDK.

I'll create a PR with the complete fix. In the meantime, the above patch can be applied with git apply.