X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7e86387958555c489ec8a397b463c437be24e1fd..1d8bb8f9bc90a492073b93ef3b422ac947c873e7:/LUFA/Drivers/USB/LowLevel/Host.c?ds=sidebyside diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c index 98185a487..e227fd194 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.c +++ b/LUFA/Drivers/USB/LowLevel/Host.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 @@ -28,11 +28,12 @@ this software. */ +#define __INCLUDE_FROM_USB_DRIVER #include "../HighLevel/USBMode.h" #if defined(USB_CAN_BE_HOST) -#define INCLUDE_FROM_HOST_C +#define __INCLUDE_FROM_HOST_C #include "Host.h" void USB_Host_ProcessNextHostState(void) @@ -296,11 +297,11 @@ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr) { USB_ControlRequest = (USB_Request_Header_t) { - bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - bRequest: REQ_GetDescriptor, - wValue: (DTYPE_Device << 8), - wIndex: 0, - wLength: sizeof(USB_Descriptor_Device_t), + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetDescriptor, + .wValue = (DTYPE_Device << 8), + .wIndex = 0, + .wLength = sizeof(USB_Descriptor_Device_t), }; Pipe_SelectPipe(PIPE_CONTROLPIPE); @@ -308,6 +309,22 @@ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr) return USB_Host_SendControlRequest(DeviceDescriptorPtr); } +uint8_t USB_Host_GetDeviceStringDescriptor(uint8_t Index, void* const Buffer, uint8_t BufferLength) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetDescriptor, + .wValue = (DTYPE_String << 8) | Index, + .wIndex = 0, + .wLength = BufferLength, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(Buffer); +} + uint8_t USB_Host_ClearPipeStall(uint8_t EndpointNum) { if (Pipe_GetPipeToken() == PIPE_TOKEN_IN)