[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] Reformatting of the reformatting



Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
 usb/include/msd.h  |    2 +-
 usb/include/uhci.h |    4 +-
 usb/include/usb.h  |    2 +-
 usb/main.c         |  202 +++++++++++++++----------------
 usb/msd.c          |  336 +++++++++++++++++++++++++---------------------------
 usb/uhci.c         |   50 ++------
 6 files changed, 274 insertions(+), 322 deletions(-)

diff --git a/usb/include/msd.h b/usb/include/msd.h
index 9f40469..1af55f3 100644
--- a/usb/include/msd.h
+++ b/usb/include/msd.h
@@ -95,4 +95,4 @@ struct part_table_entry {
 #define MSC_CMD_READ12   0xA8
 #define MSC_CMD_WRITE12  0xAA
 
-#endif
+#endif
\ No newline at end of file
diff --git a/usb/include/uhci.h b/usb/include/uhci.h
index 390298d..edb98db 100644
--- a/usb/include/uhci.h
+++ b/usb/include/uhci.h
@@ -35,7 +35,7 @@
 #define UHCI_USBSTS    0x02 //w
 #define UHCI_USBINTR   0x04 //w
 #define UHCI_FRNUM     0x06 //w
-#define UHCI_FRBASEADD 0x08     //l
+#define UHCI_FRBASEADD 0x08 //l
 #define UHCI_SOFMOD    0x0C //b
 #define UHCI_RPORTS    0x10
 #define UHCI_PORTSC1   0x10 //w
@@ -103,4 +103,4 @@ struct transfer {
     volatile int error;
 };
 
-#endif
+#endif
\ No newline at end of file
diff --git a/usb/include/usb.h b/usb/include/usb.h
index 223ecf7..3536f5a 100644
--- a/usb/include/usb.h
+++ b/usb/include/usb.h
@@ -290,4 +290,4 @@ void init_msc_driver(void);
 void register_msd(struct usb_device* usbdev);
 void uhci_init(struct cdi_device* cdi_hci);
 
-#endif
+#endif
\ No newline at end of file
diff --git a/usb/main.c b/usb/main.c
index 02079e2..0cca9b7 100644
--- a/usb/main.c
+++ b/usb/main.c
@@ -34,7 +34,7 @@
 
 #ifdef DEBUG
 #include <stdarg.h>
-#define dprintf(fmt, args...)  printf("[usb] " fmt, ## args)
+#define dprintf(fmt, args...) printf("[usb] " fmt, ## args)
 #define _dprintf(fmt, args...) printf(fmt, ## args)
 #else
 static int dprintf(const char* fmt, ...)
@@ -77,8 +77,8 @@ static const int next_data_type[9] = {
     USB_TOD_SETUP | USB_TOD_COMMAND,
     USB_TOD_SETUP | USB_TOD_COMMAND,
     USB_TOD_DATA_IN | USB_TOD_DATA_OUT | USB_TOD_STATUS,
-    USB_TOD_STATUS,
-    USB_TOD_STATUS,
+    USB_TOD_STATUS | USB_TOD_DATA_IN,
+    USB_TOD_STATUS | USB_TOD_DATA_OUT,
     USB_TOD_SETUP | USB_TOD_COMMAND
 };
 
@@ -95,30 +95,26 @@ static const int next_data_type[9] = {
    };*/
 
 /**
- * Verarbeitet ein USB-Paket.
- *
- * @param device Das USB-Gerät
- */
+  * Verarbeitet ein USB-Paket.
+  *
+  * @param device Das USB-Gerät
+  */
 
 int usb_do_packet(struct usb_device* device, struct usb_packet* packet)
 {
     int error = USB_NAK;
-    int tod_short;
+    int tod_short, tod = packet->type_of_data;
 
-    if (!(device->expects & packet->type_of_data)) {
-        dprintf("0x%04X erwartet, 0x%04X bekommen...?\n", device->expects,
-            packet->type_of_data);
+    if (!(device->expects & tod)) {
+        dprintf("0x%04X erwartet, 0x%04X bekommen...?\n", device->expects, tod);
         // FIXME Das ist keine elegante Loesung des Problems
         for (;;) {
-            ;
         }
     }
-
-    packet->type_of_data >>= 1;
-    for (tod_short = 0; packet->type_of_data; tod_short++) {
-        packet->type_of_data >>= 1;
+    tod >>= 1;
+    for (tod_short = 0; tod; tod_short++) {
+        tod >>= 1;
     }
-
     //dprintf("TOD: %s\n", tod_name[tod_short]);
     device->expects = next_data_type[tod_short];
     packet->endpoint &= 0x07;
@@ -128,20 +124,20 @@ int usb_do_packet(struct usb_device* device, struct usb_packet* packet)
         dprintf("Zugriff auf stalled-Gerät verweigert.\n");
         return USB_STALLED;
     }
-
     while (error == USB_NAK) {
-        error = device->hci->do_packet(device->hci,
-            (device->hci->get_frame(device->hci) + 3) & 0x3FF,
-            packet->type, device->id, packet->endpoint, device->low_speed,
-            packet->phys_data, packet->length, packet->datatoggle);
+        error =
+            device->hci->do_packet(device->hci,
+                (device->hci->get_frame(
+                     device->hci) + 3) & 0x3FF, packet->type, device->id,
+                packet->endpoint,
+                device->low_speed, packet->phys_data, packet->length,
+                packet->datatoggle);
     }
-
     if (error == USB_STALLED) {
-        printf("[usb] ENDPOINT %i DES GERÃ?TS %i STALLED!\n",
-            packet->endpoint, device->id);
+        printf("[usb] ENDPOINT %i DES GERÃ?TS %i STALLED!\n", packet->endpoint,
+            device->id);
         device->stalled = 1;
     }
-
     return error;
 }
 
@@ -160,18 +156,15 @@ static void* do_control(struct usb_device* device, int direction, void* buffer,
     {
         return NULL;
     }
-
-    if (cdi_alloc_phys_mem(sizeof(struct setup_packet),
-            (void**) &setup, (void**) &psetup) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct setup_packet), (void**) &setup,
+            (void**) &psetup) == -1)
     {
         return NULL;
     }
-
     direction &= 0x80;
     if ((direction == HOST_TO_DEV) && length && (buffer != NULL)) {
         memcpy(rbuf, buffer, length);
     }
-
     setup->request_type = direction | (rtype & 0x60) | (recipient & 0x1F);
     setup->request = request;
     setup->value = value;
@@ -179,12 +172,12 @@ static void* do_control(struct usb_device* device, int direction, void* buffer,
     setup->length = length;
 
     struct usb_packet setup_packet = {
-        .type           = PACKET_SETUP,
-        .endpoint       = 0,
-        .phys_data      = psetup,
-        .length         = sizeof(*setup),
-        .datatoggle     = 0,
-        .type_of_data   = USB_TOD_SETUP,
+        .type         = PACKET_SETUP,
+        .endpoint     = 0,
+        .phys_data    = psetup,
+        .length       = sizeof(*setup),
+        .datatoggle   = 0,
+        .type_of_data = USB_TOD_SETUP,
     };
 
 
@@ -192,20 +185,19 @@ static void* do_control(struct usb_device* device, int direction, void* buffer,
         return NULL;
     }
 
-    cdi_sleep_ms(20);
     if (no_data) {
         rval = USB_NO_ERROR;
         rbuf = (void*) 0xFFFFFFFF;      //Kein Fehler, aber auch keine Daten
     } else {
         struct usb_packet data_packet = {
-            .type           =
-                (direction == DEV_TO_HOST ? PACKET_IN : PACKET_OUT),
-            .endpoint       = 0,
-            .phys_data      = pbuf,
-            .length         = length,
-            .datatoggle     = 1,
-            .type_of_data   = (direction == DEV_TO_HOST ?
-                               USB_TOD_SETUP_DATA_IN : USB_TOD_SETUP_DATA_OUT),
+            .type         = (direction == DEV_TO_HOST ? PACKET_IN : PACKET_OUT),
+            .endpoint     = 0,
+            .phys_data    = pbuf,
+            .length       = length,
+            .datatoggle   = 1,
+            .type_of_data =
+                (direction ==
+                 DEV_TO_HOST ? USB_TOD_SETUP_DATA_IN : USB_TOD_SETUP_DATA_OUT),
         };
 
         rval = usb_do_packet(device, &data_packet);
@@ -219,8 +211,6 @@ static void* do_control(struct usb_device* device, int direction, void* buffer,
             .datatoggle = 1,
         };
 
-        cdi_sleep_ms(20);
-
         if (no_data || (direction == HOST_TO_DEV)) {
             ack_packet.type = PACKET_IN;
             ack_packet.type_of_data = USB_TOD_SETUP_ACK_IN;
@@ -231,7 +221,6 @@ static void* do_control(struct usb_device* device, int direction, void* buffer,
 
         rval = usb_do_packet(device, &ack_packet);
     }
-
     return (rval == USB_NO_ERROR) ? rbuf : NULL;
 }
 
@@ -246,8 +235,8 @@ static void usb_init(void)
 
     init_msc_driver();
 
-    memset(ccdriver_take_device, 0,
-        sizeof(void(*) (struct usb_device*)) * 0x100);
+    memset(ccdriver_take_device, 0, sizeof(void(*) (
+                                               struct usb_device*)) * 0x100);
     ccdriver_take_device[8] = &register_msd;
     ccdriver_take_device[9] = &enumerate_hub;
 
@@ -268,14 +257,12 @@ static void usb_init(void)
                     hci->type = HCI_UHCI;
                     cdi_list_push(uhci, hci);
                     break;
-
                 case 0x10:
                     hci = malloc(HCI_STRUCT_SIZE);
                     hci->pcidev = dev;
                     hci->type = HCI_OHCI;
                     cdi_list_push(ohci, hci);
                     break;
-
                 case 0x20:
                     hci = malloc(HCI_STRUCT_SIZE);
                     hci->pcidev = dev;
@@ -287,8 +274,8 @@ static void usb_init(void)
 
     cdi_list_destroy(pci_devices);
 
-    dprintf("%i EHCIs, %i OHCIs und %i UHCIs gefunden.\n",
-        cdi_list_size(ehci), cdi_list_size(ohci), cdi_list_size(uhci));
+    dprintf("%i EHCIs, %i OHCIs und %i UHCIs gefunden.\n", cdi_list_size(
+            ehci), cdi_list_size(ohci), cdi_list_size(uhci));
 
     uhcd = init_uhcd();
 
@@ -324,85 +311,85 @@ static void enum_device(struct usb_device* usbdev)
     usbdev->stalled = 0;
     usbdev->locked = 0;
     usbdev->expects = USB_TOD_SETUP | USB_TOD_COMMAND;
-    dev_desc = do_control(usbdev, DEV_TO_HOST, NULL, sizeof(*dev_desc),
-        STD_REQUEST, REC_DEVICE, GET_DESCRIPTOR, DESC_DEVICE << 8, 0);
+    dev_desc =
+        do_control(usbdev, DEV_TO_HOST, NULL, sizeof(*dev_desc), STD_REQUEST,
+            REC_DEVICE, GET_DESCRIPTOR, DESC_DEVICE << 8,
+            0);
     if (dev_desc == NULL) {
         return;
     }
-
     usbdev->device = dev_desc;
     dprintf("0x%04X:0x%04X (%i) -> ", dev_desc->vendor_id, dev_desc->device_id,
         dev_desc->class_id);
     do_control(usbdev, HOST_TO_DEV | NO_DATA, NULL, 0, STD_REQUEST, REC_DEVICE,
-        SET_ADDRESS, (id = usb_dev_ids++), 0);
+        SET_ADDRESS, (id = usb_dev_ids++),
+        0);
     usbdev->id = id;
     _dprintf("%i\n", id);
     if (dev_desc->iManufacturer) {
-        name = do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST,
-            REC_DEVICE, GET_DESCRIPTOR,
-            (DESC_STRING << 8) | dev_desc->iManufacturer, 0);
+        name =
+            do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST, REC_DEVICE,
+                GET_DESCRIPTOR, (DESC_STRING << 8) | dev_desc->iManufacturer,
+                0);
         if (name == NULL) {
             return;
         }
-
         dprintf(" -> Hersteller: ");
         for (i = 2; i < name[0]; i += 2) {
             _dprintf("%c", name[i]);
         }
-
         _dprintf("\n");
     }
-
     if (dev_desc->iProduct) {
-        name = do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST,
-            REC_DEVICE, GET_DESCRIPTOR,
-            (DESC_STRING << 8) | dev_desc->iProduct, 0);
+        name =
+            do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST, REC_DEVICE,
+                GET_DESCRIPTOR, (DESC_STRING << 8) | dev_desc->iProduct,
+                0);
         if (name == NULL) {
             return;
         }
-
         dprintf(" -> Produkt: ");
         for (i = 2; i < name[0]; i += 2) {
             _dprintf("%c", name[i]);
         }
-
         _dprintf("\n");
     }
-
     devices[id] = usbdev;
     //TODO: Man kann doch nicht immer den ersten nehmen...
-    conf_desc = do_control(usbdev, DEV_TO_HOST, NULL,
-        sizeof(struct config_desc), STD_REQUEST,
-        REC_DEVICE, GET_DESCRIPTOR, DESC_CONFIGURATION << 8, 0);
+    conf_desc =
+        do_control(usbdev, DEV_TO_HOST, NULL, sizeof(struct config_desc),
+            STD_REQUEST,
+            REC_DEVICE, GET_DESCRIPTOR, DESC_CONFIGURATION << 8,
+            0);
     if (conf_desc == NULL) {
         return;
     }
-
-    conf_desc = do_control(usbdev, DEV_TO_HOST, NULL, conf_desc->total_length,
-        STD_REQUEST, REC_DEVICE, GET_DESCRIPTOR, DESC_CONFIGURATION << 8, 0);
+    conf_desc =
+        do_control(usbdev, DEV_TO_HOST, NULL, conf_desc->total_length,
+            STD_REQUEST,
+            REC_DEVICE, GET_DESCRIPTOR, DESC_CONFIGURATION << 8,
+            0);
     if (conf_desc == NULL) {
         return;
     }
-
     usbdev->config = conf_desc;
     do_control(usbdev, HOST_TO_DEV, NULL, 0, STD_REQUEST, REC_DEVICE,
-        SET_CONFIGURATION, conf_desc->config_value, 0);
+        SET_CONFIGURATION, conf_desc->config_value,
+        0);
     if (conf_desc->iConfiguration) {
-        name = do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST,
-            REC_DEVICE, GET_DESCRIPTOR,
-            (DESC_STRING << 8) | conf_desc->iConfiguration, 0);
+        name =
+            do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST, REC_DEVICE,
+                GET_DESCRIPTOR, (DESC_STRING << 8) | conf_desc->iConfiguration,
+                0);
         if (name == NULL) {
             return;
         }
-
         dprintf("Verwende Konfiguration ");
         for (i = 2; i < name[0]; i += 2) {
             _dprintf("%c", name[i]);
         }
-
         _dprintf(".\n");
     }
-
     position = conf_desc;
     position += sizeof(struct config_desc);
     best_if = position;         //Standard-IF
@@ -413,33 +400,30 @@ static void enum_device(struct usb_device* usbdev)
             best_if = if_desc;
             break;
         }
-
-        position +=
-            sizeof(struct interface_desc) +
-            if_desc->num_endpoints * sizeof(struct endpoint_desc);
+        position += sizeof(struct interface_desc) + if_desc->num_endpoints *
+                    sizeof(struct endpoint_desc);
     }
-
     do_control(usbdev, HOST_TO_DEV, NULL, 0, STD_REQUEST, REC_DEVICE,
-        SET_INTERFACE, best_if->interface_number, 0);
+        SET_INTERFACE, best_if->interface_number,
+        0);
     usbdev->interface = best_if;
     if (best_if->iInterface) {
-        name = do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST,
-            REC_DEVICE, GET_DESCRIPTOR,
-            (DESC_STRING << 8) | best_if->iInterface, 0);
+        name =
+            do_control(usbdev, DEV_TO_HOST, NULL, 64, STD_REQUEST, REC_DEVICE,
+                GET_DESCRIPTOR, (DESC_STRING << 8) | best_if->iInterface,
+                0);
         if (name == NULL) {
             return;
         }
-
         dprintf("Verwende Interface ");
         for (i = 2; i < name[0]; i += 2) {
             _dprintf("%c", name[i]);
         }
-
         _dprintf(".\n");
     }
-
     dprintf("Konfiguration: %i:%i (%i)\n", conf_desc->config_value,
-        best_if->interface_number, best_if->interface_class);
+        best_if->interface_number,
+        best_if->interface_class);
     if (ccdriver_take_device[best_if->interface_class] != NULL) {
         ccdriver_take_device[best_if->interface_class](usbdev);
     }
@@ -454,22 +438,28 @@ static void enumerate_hub(struct usb_device* usbdev)
 
     //Mehr als 8 Ports sollte es nicht geben, die Grö�e des Deskriptors wird
     //daher wohl nicht grö�er als sizeof()+16 werden
-    hub_desc = do_control(usbdev, DEV_TO_HOST, NULL, sizeof(*hub_desc) + 16,
-        CLS_REQUEST, REC_DEVICE, GET_DESCRIPTOR, DESC_DEVICE << 8, 0);
+    hub_desc =
+        do_control(usbdev, DEV_TO_HOST, NULL, sizeof(*hub_desc) + 16,
+            CLS_REQUEST,
+            REC_DEVICE, GET_DESCRIPTOR, DESC_DEVICE << 8,
+            0);
     for (i = 0; i < hub_desc->nbr_ports; i++) {
-        port_status = do_control(usbdev, DEV_TO_HOST, NULL, 4, CLS_REQUEST,
-            REC_OTHER, GET_STATUS, 0, i + 1);
+        port_status =
+            do_control(usbdev, DEV_TO_HOST, NULL, 4, CLS_REQUEST, REC_OTHER,
+                GET_STATUS, 0,
+                i + 1);
         if (!(port_status[0] & PORT_DEVICE)) {
             continue;
         }
-
         //Strom an
         do_control(usbdev, HOST_TO_DEV, NULL, 0, CLS_REQUEST, REC_OTHER,
-            SET_FEATURE, PORTF_POWER, i + 1);
+            SET_FEATURE, PORTF_POWER,
+            i + 1);
         cdi_sleep_ms(hub_desc->pwron2pwrgood * 2);
         //Resetten
         do_control(usbdev, HOST_TO_DEV, NULL, 0, CLS_REQUEST, REC_OTHER,
-            SET_FEATURE, PORTF_RESET, i + 1);
+            SET_FEATURE, PORTF_RESET,
+            i + 1);
         //Reset sollte jetzt eigtl. schon beendet sein
         //(do_control wartet ja 50 ms)
         down = malloc(sizeof(struct usb_device));
@@ -494,4 +484,4 @@ void enumerate_hci(struct hci* hci)
             enum_device(usbdev);
         }
     }
-}
+}
\ No newline at end of file
diff --git a/usb/msd.c b/usb/msd.c
index 8fe029b..16d119c 100644
--- a/usb/msd.c
+++ b/usb/msd.c
@@ -41,7 +41,7 @@
 #endif
 
 #ifdef DEBUG
-#define dprintf(fmt, args...)  printf("[usb-msc] " fmt, ## args)
+#define dprintf(fmt, args...) printf("[usb-msc] " fmt, ## args)
 #define _dprintf(fmt, args...) printf(fmt, ## args)
 #else
 static int dprintf(const char* fmt, ...)
@@ -59,6 +59,7 @@ static int fdprintf(const char* fmt, ...)
 {
     return 0;
 }
+
 #endif
 
 static uint32_t cbw_tag = 1;
@@ -91,30 +92,29 @@ static int msd_get_capacity(struct usb_device* usbdev, uint32_t* block_size,
                                  8) | \
                                 (((_) & 0xFF00) << 8) | (((_) & 0xFF) << 24))
 #ifdef CPU_IS_LITTLE_ENDIAN
-#define CPU2BE(_)              change_endianess_32(_)
-#define CPU2LE(_)              (_)
-#define BE2CPU(_)              change_endianess_32(_)
-#define LE2CPU(_)              (_)
+#define CPU2BE(_)               change_endianess_32(_)
+#define CPU2LE(_)               (_)
+#define BE2CPU(_)               change_endianess_32(_)
+#define LE2CPU(_)               (_)
 #else
-#define CPU2BE(_)              (_)
-#define CPU2LE(_)              change_endianess_32(_)
-#define BE2CPU(_)              (_)
-#define LE2CPU(_)              change_endianess_32(_)
+#define CPU2BE(_)               (_)
+#define CPU2LE(_)               change_endianess_32(_)
+#define BE2CPU(_)               (_)
+#define LE2CPU(_)               change_endianess_32(_)
 #endif
 
 //Das muss definiert werden, um vor einem Befehl zu warten, bis das MSD fertig
 //ist. Theoretisch ist das äu�erst sinnvoll, praktisch hängt sich der Treiber
 //bisweilen auf - das sollte allerdings mit dem Timeout gegessen sein
 /**
- #define WAIT_FOR_MSD_READY
- */
+  #define WAIT_FOR_MSD_READY
+  */
 
 //TODO: Storage bietet eine SCSI-Klasse. Die könnte man durchaus benutzen. xD
 
 void init_msc_driver()
 {
     struct cdi_driver* stddrv = (struct cdi_driver*) &cdi_driver;
-
     stddrv->type = CDI_STORAGE;
     stddrv->name = driver_name;
     stddrv->init_device = &init_msd;
@@ -142,12 +142,10 @@ void register_msd(struct usb_device* usbdev)
         dprintf("Es werden nur bulk-only-Interfaces unterstützt.\n");
         return;
     }
-
     cdimsd = malloc(sizeof(struct cdi_msd));
     if (cdimsd == NULL) {
         return;
     }
-
     cdimsd->usb_device = usbdev;
     cdimsd->offset = 0;
     strgdev = (struct cdi_storage_device*) cdimsd;
@@ -157,7 +155,6 @@ void register_msd(struct usb_device* usbdev)
         free(strgdev);
         return;
     }
-
     sprintf((char*) strgdev->dev.name, "msd%i", msdnum++);
     msc = malloc(sizeof(struct msclass_data));
     if (msc == NULL) {
@@ -165,7 +162,6 @@ void register_msd(struct usb_device* usbdev)
         free(strgdev);
         return;
     }
-
     usbdev->classd = (struct class_data*) msc;
     msc->bulk_ep_in = NULL;
     msc->bulk_ep_out = NULL;
@@ -173,24 +169,21 @@ void register_msd(struct usb_device* usbdev)
     for (i = 0; i < usbdev->interface->num_endpoints; i++) {
         ep_desc = address;
         if ((ep_desc->endpoint_address & 0x80) &&
-            (ep_desc->attributes == 0x02) && (msc->bulk_ep_in == NULL))   //BULK-IN
+            (ep_desc->attributes == 0x02) && (msc->bulk_ep_in == NULL))                                                             //BULK-IN
         {
             msc->bulk_ep_in = ep_desc;
         } else if (!(ep_desc->endpoint_address & 0x80) &&
                    (ep_desc->attributes == 0x02) &&
-                   (msc->bulk_ep_out == NULL))          //BULK-OUT
+                   (msc->bulk_ep_out == NULL))                                                                                             //BULK-OUT
         {
             msc->bulk_ep_out = ep_desc;
         }
-
         address += sizeof(struct endpoint_desc);
     }
-
     if ((msc->bulk_ep_in == NULL) || (msc->bulk_ep_out == NULL)) {
         dprintf("Nicht genügend Endpoints gefunden.\n");
         return;
     }
-
     if (!msd_get_capacity(usbdev, &bs, &bc)) {
         strgdev->block_size = 0;
         strgdev->block_count = 0;
@@ -200,10 +193,13 @@ void register_msd(struct usb_device* usbdev)
         strgdev->block_count = bc;
         size = bs;
         size *= bc;
-        dprintf("%s: %i * %i B (ca. %lld MB).\n", strgdev->dev.name, bc, bs,
+        dprintf("%s: %i * %i B (ca. %i MB).\n", strgdev->dev.name, bc, bs,
             size >> 20);
+        dprintf("EP %i: %i; EP %i: %i\n", msc->bulk_ep_in->endpoint_address,
+            msc->bulk_ep_in->max_packet_size,
+            msc->bulk_ep_out->endpoint_address,
+            msc->bulk_ep_out->max_packet_size);
     }
-
     cdi_storage_device_init(strgdev);
     cdi_list_push(cdi_driver.drv.devices, strgdev);
     get_partitions(strgdev);
@@ -229,25 +225,25 @@ static int write_cmd(struct usb_device* usbdev, uintptr_t src)
 {
     struct msclass_data* msc = (struct msclass_data*) usbdev->classd;
     struct usb_packet cmd_packet = {
-        .type           = PACKET_OUT,
-        .endpoint       = msc->bulk_ep_out->endpoint_address,
-        .phys_data      = src,
-        .length         = 0x1F,
-        .datatoggle     = 0,
-        .type_of_data   = USB_TOD_COMMAND,
+        .type         = PACKET_OUT,
+        .endpoint     = msc->bulk_ep_out->endpoint_address,
+        .phys_data    = src,
+        .length       = 0x1F,
+        .datatoggle   = 0,
+        .type_of_data = USB_TOD_COMMAND,
     };
 
     return usb_do_packet(usbdev, &cmd_packet);
 }
 
 /**
- * Liest den Status von einem MSD
- *
- * @param usbdev Das bewusste Gerät
- * @param expected_tag Das erwartete Tag
- *
- * @return Wenn der Status OK ist USB_NO_ERROR, sonst entsprechender Fehler
- */
+  * Liest den Status von einem MSD
+  *
+  * @param usbdev Das bewusste Gerät
+  * @param expected_tag Das erwartete Tag
+  *
+  * @return Wenn der Status OK ist USB_NO_ERROR, sonst entsprechender Fehler
+  */
 
 static int read_status(struct usb_device* usbdev, uint32_t expected_tag)
 {
@@ -256,32 +252,31 @@ static int read_status(struct usb_device* usbdev, uint32_t expected_tag)
     struct command_status_wrapper* csw;
     int error;
 
-    if (cdi_alloc_phys_mem(sizeof(struct command_status_wrapper),
-            (void**) &csw, (void**) &pcsw) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct command_status_wrapper), (void**) &csw,
+            (void**) &pcsw) == -1)
     {
         return USB_TRIVIAL_ERROR;
     }
 
     struct usb_packet status_packet = {
-        .type           = PACKET_IN,
-        .endpoint       = msc->bulk_ep_in->endpoint_address,
-        .phys_data      = pcsw,
-        .length         = 0x0D,
-        .datatoggle     = 0,
-        .type_of_data   = USB_TOD_STATUS,
+        .type         = PACKET_IN,
+        .endpoint     = msc->bulk_ep_in->endpoint_address,
+        .phys_data    = pcsw,
+        .length       = 0x0D,
+        .datatoggle   = 0,
+        .type_of_data = USB_TOD_STATUS,
     };
 
     error = usb_do_packet(usbdev, &status_packet);
     if (error != USB_NO_ERROR) {
         return error;
     }
-
     if ((csw->csw_signature != CSW_SIGNATURE) ||
         (csw->csw_tag != expected_tag) || csw->csw_status)
     {
-        return USB_CRC; //Watt weiÃ? denn ich
-    }
+        return USB_CRC;         //Watt weiÃ? denn ich
 
+    }
     return USB_NO_ERROR;
 }
 
@@ -297,19 +292,16 @@ static int msd_get_capacity(struct usb_device* usbdev, uint32_t* block_size,
     if ((usbdev == NULL) || (block_size == NULL) || (block_count == NULL)) {
         return 0;
     }
-
-    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper),
-            (void**) &cbw, (void**) &pcbw) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper), (void**) &cbw,
+            (void**) &pcbw) == -1)
     {
         return 0;
     }
-
-    if (cdi_alloc_phys_mem(sizeof(struct msd_capacity),
-            (void**) &cap, (void**) &pcap) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct msd_capacity), (void**) &cap,
+            (void**) &pcap) == -1)
     {
         return 0;
     }
-
     msc = (struct msclass_data*) usbdev->classd;
     memset(cbw, 0, 0x1F);
     cbw->cbw_signature = CBW_SIGNATURE;
@@ -326,12 +318,12 @@ static int msd_get_capacity(struct usb_device* usbdev, uint32_t* block_size,
     }
 
     struct usb_packet in_packet = {
-        .type           = PACKET_IN,
-        .endpoint       = msc->bulk_ep_in->endpoint_address,
-        .phys_data      = pcap,
-        .length         = sizeof(*cap),
-        .datatoggle     = 0,
-        .type_of_data   = USB_TOD_DATA_IN,
+        .type         = PACKET_IN,
+        .endpoint     = msc->bulk_ep_in->endpoint_address,
+        .phys_data    = pcap,
+        .length       = sizeof(*cap),
+        .datatoggle   = 0,
+        .type_of_data = USB_TOD_DATA_IN,
     };
 
     if (usb_do_packet(usbdev, &in_packet) != USB_NO_ERROR) {
@@ -356,12 +348,11 @@ static int msd_ready(struct usb_device* usbdev)
     uintptr_t pcbw;
     uint32_t expected_tag;
 
-    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper),
-            (void**) &cbw, (void**) &pcbw) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper), (void**) &cbw,
+            (void**) &pcbw) == -1)
     {
         return 0;
     }
-
     msc = (struct msclass_data*) usbdev->classd;
     memset(cbw, 0, 0x1F);
     cbw->cbw_signature = CBW_SIGNATURE;
@@ -381,12 +372,12 @@ static int msd_ready(struct usb_device* usbdev)
 
     return 1;
 }
+
 #endif
 
 static inline int tsl(volatile int* variable)
 {
     int rval;
-
     rval = *variable;
     *variable = 1;
     return rval;
@@ -403,7 +394,6 @@ static int msd_cdi_read(struct cdi_storage_device* strgdev, uint64_t start,
     void* vb;
     uintptr_t pb;
     int bs = strgdev->block_size, error;
-
 #ifdef WAIT_FOR_MSD_READY
     int j;
 #endif
@@ -416,35 +406,31 @@ static int msd_cdi_read(struct cdi_storage_device* strgdev, uint64_t start,
         dprintf("Blockspeicher konnte nicht allociert werden.\n");
         return -1;
     }
-
     if (!count) {
         dprintf("Leere Leseanfrage.\n");
         return 0;
     }
-
     while (tsl(&usbdev->locked)) {
 #ifndef CDI_STANDALONE
         __asm__ __volatile__ ("hlt");
 #endif
     }
-
-    for (i = 0; i < count; i++) {
+    /*for (i = 0; i < count; i++)
+       {*/
 #ifdef WAIT_FOR_MSD_READY
-        for (j = 0; !msd_ready(usbdev) && (j < 10); j++) {
-            cdi_sleep_ms(20);
-        }
+    for (j = 0; !msd_ready(usbdev) && (j < 10); j++) {
+        cdi_sleep_ms(20);
+    }
 
 #endif
-        error = msd_read(usbdev, start + i, 1, pb, bs);
-        if (error != USB_NO_ERROR) {
-            dprintf("Lesefehler 0x%X bei Block %i.\n", error, i);
-            usbdev->locked = 0;
-            return -1;
-        }
-
-        memcpy(buffer + i * bs, vb, bs);
+    error = msd_read(usbdev, start /* + i*/, count, pb, bs);
+    if (error != USB_NO_ERROR) {
+        dprintf("Lesefehler 0x%X bei Block %i.\n", error, 0);
+        usbdev->locked = 0;
+        return -1;
     }
-
+    memcpy(buffer /* + i * bs*/, vb, count * bs);
+    //}
     usbdev->locked = 0;
     return 0;
 }
@@ -457,18 +443,16 @@ static uint32_t msd_read(struct usb_device* usbdev, uint32_t lba,
     struct command_block_wrapper* cbw;
     uintptr_t pcbw;
     uint32_t expected_tag;
-    int error;
+    int error, i, ep_size;
 
-    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper),
-            (void**) &cbw, (void**) &pcbw) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper), (void**) &cbw,
+            (void**) &pcbw) == -1)
     {
         return USB_TRIVIAL_ERROR;
     }
-
     if (!phys_buffer || !length) {
         return USB_TRIVIAL_ERROR;
     }
-
     msc = (struct msclass_data*) usbdev->classd;
     memset(cbw, 0, 0x1F);
     cbw->cbw_signature = CBW_SIGNATURE;
@@ -492,19 +476,32 @@ static uint32_t msd_read(struct usb_device* usbdev, uint32_t lba,
     }
 
     struct usb_packet in_packet = {
-        .type           = PACKET_IN,
-        .endpoint       = msc->bulk_ep_in->endpoint_address,
-        .phys_data      = phys_buffer,
-        .length         = length,
-        .datatoggle     = 0,
-        .type_of_data   = USB_TOD_DATA_IN,
+        .type         = PACKET_IN,
+        .endpoint     = msc->bulk_ep_in->endpoint_address,
+        .phys_data    = phys_buffer,
+        .length       = 0,
+        .datatoggle   = 0,
+        .type_of_data = USB_TOD_DATA_IN,
     };
 
-    error = usb_do_packet(usbdev, &in_packet);
-    if (error != USB_NO_ERROR) {
-        return error;
+    //Transaktionen eintragen
+    ep_size = msc->bulk_ep_in->max_packet_size;
+    for (i = 0; i < length; i += ep_size) {
+        in_packet.length = (length - i > ep_size) ? ep_size : length - i;
+        error = usb_do_packet(usbdev, &in_packet);
+        if (error != USB_NO_ERROR) {
+            return error;
+        }
+        in_packet.phys_data += ep_size;
+        in_packet.datatoggle ^= 1;
     }
 
+    /*//Auf deren Ende warten
+       for (i = 0; i < length; i += ep_size)
+       {
+
+       }*/
+
     error = read_status(usbdev, expected_tag);
     if (error != USB_NO_ERROR) {
         return error;
@@ -524,7 +521,6 @@ static int msd_cdi_write(struct cdi_storage_device* strgdev, uint64_t start,
     void* vb;
     uintptr_t pb;
     int bs = strgdev->block_size, error;
-
 #ifdef WAIT_FOR_MSD_READY
     int j;
 #endif
@@ -537,13 +533,11 @@ static int msd_cdi_write(struct cdi_storage_device* strgdev, uint64_t start,
         dprintf("Blockspeicher zum Schreiben konnte nicht allociert werden.\n");
         return -1;
     }
-
     while (tsl(&usbdev->locked)) {
 #ifndef CDI_STANDALONE
         __asm__ __volatile__ ("hlt");
 #endif
     }
-
     for (i = 0; i < count; i++) {
         memcpy(vb, buffer + i * bs, bs);
 #ifdef WAIT_FOR_MSD_READY
@@ -559,7 +553,6 @@ static int msd_cdi_write(struct cdi_storage_device* strgdev, uint64_t start,
             return -1;
         }
     }
-
     usbdev->locked = 0;
     return 0;
 }
@@ -568,71 +561,71 @@ static uint32_t msd_write(struct usb_device* usbdev, uint32_t lba,
     uint16_t sectors, uintptr_t phys_buffer,
     size_t length)
 {
-    struct msclass_data* msc;
-    struct command_block_wrapper* cbw;
-    struct command_status_wrapper* csw;
-    uintptr_t pcbw, pcsw;
-    uint32_t expected_tag;
-    int error;
-
-    if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper),
-            (void**) &cbw, (void**) &pcbw) == -1)
-    {
-        return USB_TRIVIAL_ERROR;
-    }
-
-    if (cdi_alloc_phys_mem(sizeof(struct command_status_wrapper),
-            (void**) &csw, (void**) &pcsw) == -1)
-    {
-        return USB_TRIVIAL_ERROR;
-    }
-
-    if (!phys_buffer || !length) {
-        return USB_TRIVIAL_ERROR;
-    }
-
-    msc = (struct msclass_data*) usbdev->classd;
-    memset(cbw, 0, 0x1F);
-    cbw->cbw_signature = CBW_SIGNATURE;
-    cbw->cbw_tag = (expected_tag = cbw_tag++);
-    cbw->cbw_data_transfer_length = length;
-    cbw->cbw_flags = 0x00;      //OUT
-    cbw->cbw_lun = 0;           //Was weiÃ? ich, wie viele LUNs datt Dingens hat?
-    cbw->cbw_cb_length = 12;
-    cbw->cbw_cb[0] = MSC_CMD_WRITE10;
-    cbw->cbw_cb[1] = 0;         //LUN: 0
-    cbw->cbw_cb[2] = (lba & 0xFF000000) >> 24;
-    cbw->cbw_cb[3] = (lba & 0x00FF0000) >> 16;
-    cbw->cbw_cb[4] = (lba & 0x0000FF00) >> 8;
-    cbw->cbw_cb[5] = lba & 0x000000FF;
-    cbw->cbw_cb[7] = (sectors & 0x0000FF00) >> 8;
-    cbw->cbw_cb[8] = sectors & 0x000000FF;
-
-    error = write_cmd(usbdev, pcbw);
-    if (error != USB_NO_ERROR) {
-        return error;
-    }
-
-    struct usb_packet out_packet = {
-        .type           = PACKET_OUT,
-        .endpoint       = msc->bulk_ep_out->endpoint_address,
-        .phys_data      = phys_buffer,
-        .length         = length,
-        .datatoggle     = 0,
-        .type_of_data   = USB_TOD_DATA_OUT,
-    };
-
-    error = usb_do_packet(usbdev, &out_packet);
-    if (error != USB_NO_ERROR) {
-        return error;
-    }
-
-    error = read_status(usbdev, expected_tag);
-    if (error != USB_NO_ERROR) {
-        return error;
-    }
-
-    return USB_NO_ERROR;
+    /*struct msclass_data *msc;
+       struct command_block_wrapper *cbw;
+       struct command_status_wrapper *csw;
+       uintptr_t pcbw, pcsw;
+       uint32_t expected_tag;
+       int error;
+
+       if (cdi_alloc_phys_mem(sizeof(struct command_block_wrapper), (void **)&cbw, (void **)&pcbw) == -1)
+       {
+       return USB_TRIVIAL_ERROR;
+       }
+       if (cdi_alloc_phys_mem(sizeof(struct command_status_wrapper), (void **)&csw, (void **)&pcsw) == -1)
+       {
+       return USB_TRIVIAL_ERROR;
+       }
+       if (!phys_buffer || !length)
+       {
+       return USB_TRIVIAL_ERROR;
+       }
+       msc = (struct msclass_data *)usbdev->classd;
+       memset(cbw, 0, 0x1F);
+       cbw->cbw_signature = CBW_SIGNATURE;
+       cbw->cbw_tag = (expected_tag = cbw_tag++);
+       cbw->cbw_data_transfer_length = length;
+       cbw->cbw_flags = 0x00;       //OUT
+       cbw->cbw_lun = 0;            //Was weiÃ? ich, wie viele LUNs datt Dingens hat?
+       cbw->cbw_cb_length = 12;
+       cbw->cbw_cb[0] = MSC_CMD_WRITE10;
+       cbw->cbw_cb[1] = 0;          //LUN: 0
+       cbw->cbw_cb[2] = (lba & 0xFF000000) >> 24;
+       cbw->cbw_cb[3] = (lba & 0x00FF0000) >> 16;
+       cbw->cbw_cb[4] = (lba & 0x0000FF00) >> 8;
+       cbw->cbw_cb[5] = lba & 0x000000FF;
+       cbw->cbw_cb[7] = (sectors & 0x0000FF00) >> 8;
+       cbw->cbw_cb[8] = sectors & 0x000000FF;
+
+       error = write_cmd(usbdev, pcbw);
+       if (error != USB_NO_ERROR)
+       {
+       return error;
+       }
+
+       struct usb_packet out_packet = {
+       .type = PACKET_OUT,
+       .endpoint = msc->bulk_ep_out->endpoint_address,
+       .phys_data = phys_buffer,
+       .length = length,
+       .datatoggle = 0,
+       .type_of_data = USB_TOD_DATA_OUT,
+       };
+
+       error = usb_do_packet(usbdev, &out_packet);
+       if (error != USB_NO_ERROR)
+       {
+       return error;
+       }
+
+       error = read_status(usbdev, expected_tag);
+       if (error != USB_NO_ERROR)
+       {
+       return error;
+       }
+
+       return USB_NO_ERROR;*/
+    return USB_STALLED;
 }
 
 static void get_partitions(struct cdi_storage_device* cdistrg)
@@ -647,23 +640,19 @@ static void get_partitions(struct cdi_storage_device* cdistrg)
         dprintf("MBR konnte nicht eingelesen werden.\n");
         return;
     }
-
     if (((uint16_t*) mbr)[255] != 0xAA55) {
         return;
     }
-
     partition = mbr + 0x1BE;
     dprintf("Partitionen auf %s:", cdistrg->dev.name);
     for (i = 0; i < 4; i++) {
-        if (partition[i].type && partition[i].size
-            && (partition[i].start + partition[i].size <
-                cdistrg->block_count))
+        if (partition[i].type && partition[i].size &&
+            (partition[i].start + partition[i].size < cdistrg->block_count))
         {
             cdimsd = malloc(sizeof(struct cdi_msd));
             if (cdimsd == NULL) {
                 break;
             }
-
             cdimsd->offset = partition[i].start;
             cdimsd->usb_device = base_cdimsd->usb_device;
             cdimsd->cdi_device.dev.type = CDI_STORAGE;
@@ -672,9 +661,9 @@ static void get_partitions(struct cdi_storage_device* cdistrg)
                 free(cdimsd);
                 break;
             }
-
             sprintf((char*) cdimsd->cdi_device.dev.name, "%sp%i",
-                cdistrg->dev.name, j++);
+                cdistrg->dev.name,
+                j++);
             cdimsd->cdi_device.block_size = base_cdimsd->cdi_device.block_size;
             cdimsd->cdi_device.block_count = partition[i].size;
             _dprintf(" %s", cdimsd->cdi_device.dev.name);
@@ -682,6 +671,5 @@ static void get_partitions(struct cdi_storage_device* cdistrg)
             cdi_list_push(cdi_driver.drv.devices, cdimsd);
         }
     }
-
     _dprintf("\n");
-}
+}
\ No newline at end of file
diff --git a/usb/uhci.c b/usb/uhci.c
index 208000e..e73d584 100644
--- a/usb/uhci.c
+++ b/usb/uhci.c
@@ -36,7 +36,7 @@
 #ifdef DEBUG
 #include <stdio.h>
 #include <stdarg.h>
-#define dprintf(fmt, args...)  printf("[uhci] " fmt, ## args)
+#define dprintf(fmt, args...) printf("[uhci] " fmt, ## args)
 #define _dprintf(fmt, args...) printf(fmt, ## args)
 #else
 static int dprintf(const char* fmt, ...)
@@ -85,7 +85,7 @@ static void uhci_deinit(struct cdi_device* cdi_hci)
 {
     cdi_outw(
         ((struct uhci*) ((struct cdi_hci*) cdi_hci)->hci)->pbase + UHCI_USBCMD,
-        MAXP);     //HC anhalten
+        MAXP);                                                                                  //HC anhalten
     //TODO: Hier doch auch
 }
 
@@ -107,36 +107,31 @@ void uhci_init(struct cdi_device* cdi_hci)
                 dprintf("I/O-Ports konnten nicht reserviert werden.\n");
                 return;
             }
-
             uhci->pbase = res->start;
             break;
         }
     }
-
     if (!uhci->pbase) {
         dprintf("I/O-Basis nicht gefunden!\n");
         return;
     }
-
     if (cdi_alloc_phys_mem(4096, (void**) &uhci->frame_list,
             (void**) &uhci->phys_frame_list) == -1)
     {
         dprintf("Frame List konnte nicht allociert werden!\n");
         return;
     }
-
     cdi_register_irq(gen_hci->pcidev->irq, &uhci_handler, cdi_hci);
     uhci->root_ports = (size - 0x10) >> 1;
-    if (uhci->root_ports > 7) { //Laut Linuxkernel ist das so "weird", dass da was nicht stimmen kann...
+    if (uhci->root_ports > 7) {                         //Laut Linuxkernel ist das so "weird", dass da was nicht stimmen kann...
         uhci->root_ports = 2;
     }
-
     dprintf("UHC mit I/O 0x%04X (%i Ports) und IRQ %i\n", uhci->pbase,
-        uhci->root_ports, gen_hci->pcidev->irq);
+        uhci->root_ports,
+        gen_hci->pcidev->irq);
     for (i = 0; i < 1024; i++) {
-        uhci->frame_list[i] = 1;        //Invalid
+        uhci->frame_list[i] = 1; //Invalid
     }
-
     dprintf("Resetten...\n");
     //HC zurücksetzen
     cdi_outw(uhci->pbase + UHCI_USBCMD, MAXP | HCRESET);
@@ -145,7 +140,6 @@ void uhci_init(struct cdi_device* cdi_hci)
     {
         cdi_sleep_ms(10);
     }
-
     //Reset auf dem USB treiben
     cdi_outw(uhci->pbase + UHCI_USBCMD, MAXP | GRESET);
     for (i = 0; (cdi_inw(uhci->pbase + UHCI_USBCMD) & GRESET) && (i < 50);
@@ -153,7 +147,6 @@ void uhci_init(struct cdi_device* cdi_hci)
     {
         cdi_sleep_ms(10);
     }
-
     //Alle Interrupts senden
     cdi_outw(uhci->pbase + UHCI_USBINTR, 0xF);
     //Framelistadresse eintragen
@@ -163,7 +156,6 @@ void uhci_init(struct cdi_device* cdi_hci)
     for (i = 0; i < uhci->root_ports; i++) {
         cdi_outw(uhci->pbase + UHCI_RPORTS + i * 2, RPORT_CSC);
     }
-
     dprintf("  Fertig\n");
     gen_hci->find_devices = &get_devices;
     gen_hci->activate_device = &activate_device;
@@ -187,7 +179,6 @@ static cdi_list_t get_devices(struct hci* gen_hci)
             _dprintf("-");
             continue;
         }
-
         _dprintf("!");
         dev = malloc(sizeof(struct usb_device));
         dev->hci = gen_hci;
@@ -197,7 +188,6 @@ static cdi_list_t get_devices(struct hci* gen_hci)
             (cdi_inw(uhci->pbase + UHCI_RPORTS + 2 * i) & RPORT_LOSPD) && 1;
         cdi_list_push(dlist, dev);
     }
-
     _dprintf("\n");
     return dlist;
 }
@@ -220,7 +210,6 @@ static int get_current_frame(struct hci* gen_hci)
 static inline int tsl(volatile int* variable)
 {
     int rval;
-
     rval = *variable;
     *variable = 1;
     return rval;
@@ -239,24 +228,21 @@ static int enqueue_request(struct hci* gen_hci, int frame, int type, int device,
     struct transfer* addr;
     int timeout;
 
-    if (cdi_alloc_phys_mem(sizeof(struct uhci_td),
-            (void**) &td, (void**) &ptd) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct uhci_td), (void**) &td,
+            (void**) &ptd) == -1)
     {
         return USB_TRIVIAL_ERROR;
     }
-
-    if (cdi_alloc_phys_mem(sizeof(struct uhci_qh),
-            (void**) &qh, (void**) &pqh) == -1)
+    if (cdi_alloc_phys_mem(sizeof(struct uhci_qh), (void**) &qh,
+            (void**) &pqh) == -1)
     {
         return USB_TRIVIAL_ERROR;
     }
-
     while (tsl(&locked)) {
 #ifndef CDI_STANDALONE
         __asm__ __volatile__ ("hlt");
 #endif
     }
-
     qh->next = 1;               //Invalid
     qh->transfer = ptd;
     memset(td, 0, sizeof(struct uhci_td));
@@ -280,13 +266,11 @@ static int enqueue_request(struct hci* gen_hci, int frame, int type, int device,
     for (timeout = 0; !(qh->transfer & 1) && (timeout < 1000); timeout++) {
         cdi_sleep_ms(1);
     }
-
     while ((timeout < 1000) && (addr->error == 0xFFFF)) {
 #ifndef CDI_STANDALONE
         __asm__ __volatile__ ("hlt");
 #endif
     }
-
     uhci->frame_list[frame] = 1;
     locked = 0;
     return addr->error;
@@ -299,14 +283,12 @@ static void uhci_handler(struct cdi_device* cdi_hci)
     struct transfer* addr;
     struct uhci_td* td;
 
-    if (!status) {              //Also, von hier kommt der IRQ nicht.
+    if (!status) {                         //Also, von hier kommt der IRQ nicht.
         return;
     }
-
     if (status & ~0x0001) {
         dprintf("Unerwarteter IRQ 0x%04X von %s\n", status, cdi_hci->name);
     }
-
     if (status & 0x10) {
         printf("[uhci] SCHWERWIEGENDER FEHLER - HC WIRD ANGEHALTEN\n");
         cdi_outw(uhci->pbase + UHCI_USBCMD, MAXP | HCRESET);    //FU!
@@ -316,42 +298,34 @@ static void uhci_handler(struct cdi_device* cdi_hci)
             if (td->active) {
                 continue;
             }
-
             addr->error = USB_NO_ERROR;
             cdi_list_remove(active_transfers, i--);
             if (td->stalled_err) {
                 dprintf("ENDPOINT STALLED\n");
                 addr->error |= USB_STALLED;
             }
-
             if (td->buf_err) {
                 dprintf("Pufferüberlauf oder Underrun\n");
                 addr->error |= USB_BUFFER_ERROR;
             }
-
             if (td->babble) {
                 dprintf("Da war ein Gerät wohl sehr gesprächig: Babble.\n");
                 addr->error |= USB_BABBLE;
             }
-
             if (td->nak) {
                 dprintf("NAK empfangen\n");
                 addr->error |= USB_NAK;
             }
-
             if (td->crc_time_err) {
                 dprintf("CRC-Fehler oder Timeout\n");
                 addr->error |= USB_CRC | USB_TIMEOUT;
             }
-
             if (td->bitstuff_err) {
                 dprintf("Bitstufffehler\n");
                 addr->error |= USB_BITSTUFF;
             }
-
             //TODO: free(td) - dazu wäre eine CDI-Funktion nützlich
         }
     }
-
     cdi_outw(uhci->pbase + UHCI_USBSTS, status);
-}
+}
\ No newline at end of file
-- 
1.6.3.3