Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / workbench / devs / USB / drivers / OHCI / ohcideviceclass.c
blob9f50f2ccfabbd4671a5fd0363ff9adfed7f9d000
1 /*
2 Copyright (C) 2006 by Michal Schulz
3 $Id$
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #define DEBUG 0
23 #include <inttypes.h>
25 #include <exec/types.h>
26 #include <oop/oop.h>
27 #include <usb/usb.h>
28 #include <utility/tagitem.h>
29 #include <aros/debug.h>
30 #include <aros/symbolsets.h>
32 #include <hidd/hidd.h>
33 #include <hidd/pci.h>
35 #include <proto/oop.h>
36 #include <proto/utility.h>
38 #include <stdio.h>
40 #include "ohci.h"
42 static const usb_device_descriptor_t device_descriptor = {
43 bLength: sizeof(usb_device_descriptor_t),
44 bDescriptorType: UDESC_DEVICE,
45 bcdUSB: 0x0101,
46 bDeviceClass: UDCLASS_HUB,
47 bDeviceSubClass: UDSUBCLASS_HUB,
48 bDeviceProtocol: UDPROTO_FSHUB,
49 bMaxPacketSize: 64,
50 iManufacturer: 2,
51 iProduct: 1,
52 iSerialNumber: 3,
53 bNumConfigurations: 1,
56 static usb_endpoint_descriptor_t endpoint_descriptor = {
57 bLength: sizeof(usb_endpoint_descriptor_t),
58 bDescriptorType: UDESC_ENDPOINT,
59 bEndpointAddress: 0x81,
60 bmAttributes: 0x03,
61 wMaxPacketSize: 1,
62 bInterval: 255
65 static const char *string1 = "O\0H\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B";
66 static const int string1_l = sizeof("O\0H\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B");
68 static const char *string2 = "T\0h\0e\0 \0A\0R\0O\0S\0 \0D\0e\0v\0e\0l\0o\0p\0m\0e\0n\0t\0 \0T\0e\0a\0m";
69 static const int string2_l = sizeof("T\0h\0e\0 \0A\0R\0O\0S\0 \0D\0e\0v\0e\0l\0o\0p\0m\0e\0n\0t\0 \0T\0e\0a\0m");
71 BOOL METHOD(OHCI, Hidd_USBDevice, GetString)
73 msg->string->bDescriptorType = UDESC_STRING;
75 if (msg->id == USB_LANGUAGE_TABLE)
77 msg->string->bLength = 4;
78 msg->string->bString[0] = 0x0409;
80 else if (msg->id == 1)
82 msg->string->bLength = 2 + string1_l;
83 CopyMem(string1, &msg->string->bString[0], string1_l);
85 else if (msg->id == 2)
87 msg->string->bLength = 2 + string2_l;
88 CopyMem(string2, &msg->string->bString[0], string2_l);
90 else if (msg->id == 3)
92 char buff[129];
93 int i;
94 snprintf(buff, 128, "%04d.%04d", VERSION_NUMBER, REVISION_NUMBER);
95 msg->string->bLength = 2 + 2*strlen(buff);
96 for (i=0; i < ((msg->string->bLength - 2) >> 1); i++)
97 msg->string->bString[i] = AROS_WORD2LE(buff[i]);
99 else
101 return FALSE;
103 return TRUE;
106 const usb_endpoint_descriptor_t * METHOD(OHCI, Hidd_USBDevice, GetEndpoint)
108 endpoint_descriptor.wMaxPacketSize = AROS_WORD2LE(1);
110 if (msg->interface == 0 && msg->endpoint == 0)
111 return &endpoint_descriptor;
112 else
113 return NULL;
116 BOOL METHOD(OHCI, Hidd_USBDevice, GetDeviceDescriptor)
118 CopyMem(&device_descriptor, msg->descriptor, sizeof(device_descriptor));
119 return TRUE;
122 BOOL METHOD(OHCI, Hidd_USBDevice, Configure)
124 D(bug("[OHCI] Configure(%d)\n", msg->configNr));
125 return TRUE;
128 APTR METHOD(OHCI, Hidd_USBDevice, CreatePipe)
130 if ( (msg->type == PIPE_Interrupt) &&
131 (msg->endpoint == 0x81))
132 return (APTR)0xdeadbeef;
133 else
134 return NULL;
137 void METHOD(OHCI, Hidd_USBDevice, DeletePipe)
141 void METHOD(OHCI, Hidd_USBDevice, SetTimeout)