~ubuntu-branches/ubuntu/raring/vice/raring

« back to all changes in this revision

Viewing changes to src/arch/unix/joy_usb.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20090331003715-mzclchtl0dp7fcl0
Tags: upstream-2.1.dfsg
ImportĀ upstreamĀ versionĀ 2.1.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
        if (fd < 0)
165
165
            continue;
166
166
 
 
167
#if defined(USB_GET_REPORT_ID) && !defined(__DragonFly__)
167
168
        if (ioctl(fd, USB_GET_REPORT_ID, &id) < 0) {
168
169
            log_warning(joystick_log,
169
 
                        _("Cannot get report id for joystick device `%s'."),
 
170
                        "Cannot get report id for joystick device `%s'.",
170
171
                        dev);
171
172
            close(fd);
172
173
        }
 
174
#endif
173
175
 
174
176
        if ((report=hid_get_report_desc(fd)) == NULL) {
175
177
            log_warning(joystick_log,
176
 
                _("Cannot report description for joystick device `%s'."),
 
178
                "Cannot report description for joystick device `%s'.",
177
179
                dev);
178
180
            close(fd);
179
181
            continue;
184
186
 
185
187
        found = 0;
186
188
        is_joy = 0;
 
189
#if !defined(HAVE_USBHID_H) && !defined(HAVE_LIBUSB_H) && defined(HAVE_LIBUSBHID)
 
190
        for (d=hid_start_parse(report, id);
 
191
#else
187
192
        for (d=hid_start_parse(report, 1<<hid_input, id);
 
193
#endif
188
194
             hid_get_item(d, &h);) {
189
195
            if (h.kind == hid_collection
190
196
                && HID_PAGE(h.usage) == HUP_GENERIC_DESKTOP
233
239
            close(fd);
234
240
            usb_free_item(usb_joy_item+i);
235
241
            log_message(joystick_log,
236
 
                     _("Not all axes found in joystick device `%s'."), dev);
 
242
                     "Not all axes found in joystick device `%s'.", dev);
237
243
            continue;
238
244
        }
239
245
        
240
246
        if ((usb_joy_buf[i]=malloc(usb_joy_size[i])) == NULL) {
241
247
            log_warning(joystick_log,
242
 
                        _("Cannot allocate buffer for joystick device `%s'."),
 
248
                        "Cannot allocate buffer for joystick device `%s'.",
243
249
                        dev);
244
250
            close(fd);
245
251
            usb_free_item(usb_joy_item+i);
247
253
        }
248
254
 
249
255
        log_message(joystick_log,
250
 
                    _("USB joystick found: `%s'."), dev);
 
256
                    "USB joystick found: `%s'.", dev);
251
257
        usb_joy_fd[i] = fd;
252
258
        i++;
253
259
    }