Fix PrinterHost demo so that it will only enumerate printers with Bidirectional proto...
[pub/USBasp.git] / Demos / Host / Incomplete / PrinterHost / ConfigDescriptor.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 #ifndef _CONFIGDESCRIPTOR_H_
32 #define _CONFIGDESCRIPTOR_H_
33
34 /* Includes: */
35 #include <LUFA/Drivers/USB/USB.h>
36
37 #include "PrinterHost.h"
38
39 /* Macros: */
40 #define PRINTER_CLASS 0x07
41 #define PRINTER_SUBCLASS 0x01
42
43 #define PRINTER_DATA_OUT_PIPE 1
44 #define PRINTER_DATA_IN_PIPE 2
45
46 #define MAX_CONFIG_DESCRIPTOR_SIZE 512
47
48 /* Enums: */
49 enum PrinterHost_GetConfigDescriptorDataCodes_t
50 {
51 SuccessfulConfigRead = 0,
52 ControlError = 1,
53 DescriptorTooLarge = 2,
54 InvalidConfigDataReturned = 3,
55 NoInterfaceFound = 4,
56 NoEndpointFound = 5,
57 };
58
59 /* External Variables: */
60 uint8_t PrinterInterfaceNumber;
61 uint8_t PrinterAltSetting;
62
63 /* Function Prototypes: */
64 uint8_t ProcessConfigurationDescriptor(void);
65
66 uint8_t NextBidirectionalPrinterInterface(void* CurrentDescriptor);
67 uint8_t NextInterfaceBulkDataEndpoint(void* CurrentDescriptor);
68
69 #endif