Ticket #8833: usb_hid.patch

File usb_hid.patch, 3.3 KB (added by anevilyak, 12 years ago)

Port usb_hid to x86-64

  • build/jam/Haiku64Image

    diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image
    index 9d857c6..5175e8d 100644
    a b if $(HAIKU_ATA_STACK) = 1 {  
    2121
    2222SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr chgrp chmod
    2323    chown chroot cksum clear clockconfig cmp collectcatkeys comm compress
    24     copyattr cp csplit cut date dd diff diff3 dircolors dirname du
     24    copyattr cp csplit cut date dd diff diff3 dircolors dirname df du
    2525    dumpcatalog echo eject env error expand expr factor false find finddir
    2626    fmt fold fortune gawk gzip gzexe getlimits groups head hostname id
    2727    <bin>install isvolume join kernel_debugger kill less lessecho lesskey link
    AddNewDriversToHaikuImage disk scsi : scsi_cd scsi_disk ;  
    8383AddDriversToHaikuImage              : console dprintf null
    8484                                      random <driver>tty zero ;
    8585AddDriversToHaikuImage disk usb         : usb_disk ;
    86 AddDriversToHaikuImage input        : ps2_hid ;
     86AddDriversToHaikuImage input        : ps2_hid usb_hid ;
    8787# kernel
    8888AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ;
    8989
  • src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp

    diff --git a/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp b/src/add-ons/kernel/drivers/input/usb_hid/Driver.cpp
    index 657b7f5..51ca81f 100644
    a b usb_hid_device_added(usb_device device, void **cookie)  
    6262    // ensure default configuration is set
    6363    status_t result = gUSBModule->set_configuration(device, config);
    6464    if (result != B_OK) {
    65         TRACE_ALWAYS("set_configuration() failed 0x%08lx\n", result);
     65        TRACE_ALWAYS("set_configuration() failed 0x%08" B_PRIx32 "\n", result);
    6666        return result;
    6767    }
    6868
    usb_hid_device_added(usb_device device, void **cookie)  
    7878    for (size_t i = 0; i < config->interface_count; i++) {
    7979        const usb_interface_info *interface = config->interface[i].active;
    8080        uint8 interfaceClass = interface->descr->interface_class;
    81         TRACE("interface %lu: class: %u; subclass: %u; protocol: %u\n",
    82             i, interfaceClass, interface->descr->interface_subclass,
     81        TRACE("interface %" B_PRIuSIZE ": class: %u; subclass: %u; protocol: "
     82            "%u\n", i, interfaceClass, interface->descr->interface_subclass,
    8383            interface->descr->interface_protocol);
    8484
    8585        // check for quirky devices first
    usb_hid_device_added(usb_device device, void **cookie)  
    128128                    char pathBuffer[128];
    129129                    const char *basePath = handler->BasePath();
    130130                    while (true) {
    131                         sprintf(pathBuffer, "%s%ld", basePath, index++);
     131                        sprintf(pathBuffer, "%s%" B_PRId32, basePath, index++);
    132132                        if (gDeviceList->FindDevice(pathBuffer) == NULL) {
    133133                            // this name is still free, use it
    134134                            handler->SetPublishPath(strdup(pathBuffer));
    usb_hid_device_added(usb_device device, void **cookie)  
    149149    if (!devicesFound)
    150150        return B_ERROR;
    151151
    152     *cookie = (void *)parentCookie;
     152    *cookie = (void *)(addr_t)parentCookie;
    153153    return B_OK;
    154154}
    155155
    status_t  
    158158usb_hid_device_removed(void *cookie)
    159159{
    160160    mutex_lock(&sDriverLock);
    161     int32 parentCookie = (int32)cookie;
    162     TRACE("device_removed(%ld)\n", parentCookie);
     161    int32 parentCookie = (int32)(addr_t)cookie;
     162    TRACE("device_removed(%" B_PRId32 ")\n", parentCookie);
    163163
    164164    for (int32 i = 0; i < gDeviceList->CountDevices(); i++) {
    165165        ProtocolHandler *handler = (ProtocolHandler *)gDeviceList->DeviceAt(i);