X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/bf041e8bbf67222e1c899b8df96f8220d5a0d9d2..03ee87b35abdb8b92e8b55ec040fa943f9a6786c:/Demos/Device/Incomplete/Sideshow/Descriptors.c diff --git a/Demos/Device/Incomplete/Sideshow/Descriptors.c b/Demos/Device/Incomplete/Sideshow/Descriptors.c index 5691d456e..f04b2f6a0 100644 --- a/Demos/Device/Incomplete/Sideshow/Descriptors.c +++ b/Demos/Device/Incomplete/Sideshow/Descriptors.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -42,8 +42,8 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor = Endpoint0Size: 8, VendorID: 0x03EB, - ProductID: 0xDC03, - ReleaseNumber: 0x0000, + ProductID: 0x2040, + ReleaseNumber: 0x0001, ManufacturerStrIndex: 0x01, ProductStrIndex: 0x02, @@ -154,7 +154,7 @@ USB_OSCompatibleIDDescriptor_t PROGMEM DevCompatIDs = SubCompatibleID: "UNIV1"} }; -uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress) { const uint8_t DescriptorType = (wValue >> 8); const uint8_t DescriptorNumber = (wValue & 0xFF); @@ -165,39 +165,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; case 0x03: - Address = DESCRIPTOR_ADDRESS(SerialNumberString); + Address = (void*)&SerialNumberString; Size = pgm_read_byte(&SerialNumberString.Header.Size); break; case 0xEE: - /* Great, another Microsoft-proprietary extention. String address 0xEE is used - by Windows for "OS Descriptors", which in this case allows us to indicate that - our device is Sideshow compatible. Most people would be happy using the normal - 0xFF 0x?? 0x?? Class/Subclass/Protocol values like the USBIF intended. */ - - Address = DESCRIPTOR_ADDRESS(OSDescriptorString); + /* A Microsoft-proprietary extention. String address 0xEE is used by Windows for + "OS Descriptors", which in this case allows us to indicate that our device is + Sideshow compatible regardless of VID/PID values. */ + Address = (void*)&OSDescriptorString; Size = pgm_read_byte(&OSDescriptorString.Header.Size); break; } @@ -221,7 +219,7 @@ bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex, /* Only the Extended Device Compatibility descriptor is supported */ if (wIndex == EXTENDED_COMPAT_ID_DESCRIPTOR) { - Address = DESCRIPTOR_ADDRESS(DevCompatIDs); + Address = (void*)&DevCompatIDs; Size = sizeof(USB_OSCompatibleIDDescriptor_t); } }