mirror of https://github.com/xemu-project/xemu.git
Improve XID code quality
This commit is contained in:
parent
ffba4cfb7a
commit
7bfec09454
|
@ -222,19 +222,11 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p,
|
||||||
{
|
{
|
||||||
USBXIDState *s = DO_UPCAST(USBXIDState, dev, dev);
|
USBXIDState *s = DO_UPCAST(USBXIDState, dev, dev);
|
||||||
|
|
||||||
static unsigned int pid = 0;
|
DPRINTF("xid handle_control 0x%x 0x%x\n", request, value);
|
||||||
static size_t bytes = 0;
|
|
||||||
DPRINTF("xid handle_control 0x%x 0x%x, packet %zu, byte %d\n", request, value, ++pid, bytes += length);
|
|
||||||
#if 0
|
|
||||||
if ((request == USB_REQ_SET_CONFIGURATION) && (value == 1)) {
|
|
||||||
/* The OpenXDK code will try to set configuration 1 on every read */
|
|
||||||
DPRINTF("xid handled by configuration hack\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
int ret = usb_desc_handle_control(dev, p, request, value, index, length, data);
|
int ret = usb_desc_handle_control(dev, p, request, value, index, length, data);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
DPRINTF("xid handled by usb_desc_handle_control: %d\n",ret);
|
DPRINTF("xid handled by usb_desc_handle_control: %d\n", ret);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +236,7 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p,
|
||||||
DPRINTF("xid GET_REPORT 0x%x\n", value);
|
DPRINTF("xid GET_REPORT 0x%x\n", value);
|
||||||
if (value == 0x100) { /* input */
|
if (value == 0x100) { /* input */
|
||||||
assert(s->in_state.bLength <= length);
|
assert(s->in_state.bLength <= length);
|
||||||
// s->in_state.bReportId++; FIXME: Like this?
|
// s->in_state.bReportId++; /* FIXME: I'm not sure if bReportId is just a counter */
|
||||||
memcpy(data, &s->in_state, s->in_state.bLength);
|
memcpy(data, &s->in_state, s->in_state.bLength);
|
||||||
p->actual_length = s->in_state.bLength;
|
p->actual_length = s->in_state.bLength;
|
||||||
} else {
|
} else {
|
||||||
|
@ -259,9 +251,9 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p,
|
||||||
assert(s->out_state.length == sizeof(s->out_state));
|
assert(s->out_state.length == sizeof(s->out_state));
|
||||||
assert(s->out_state.length <= length);
|
assert(s->out_state.length <= length);
|
||||||
//FIXME: Check actuator endianess
|
//FIXME: Check actuator endianess
|
||||||
printf("Set rumble power to 0x%x, 0x%x\n",
|
DPRINTF("Set rumble power to 0x%x, 0x%x\n",
|
||||||
s->out_state.left_actuator_strength,
|
s->out_state.left_actuator_strength,
|
||||||
s->out_state.right_actuator_strength);
|
s->out_state.right_actuator_strength);
|
||||||
p->actual_length = s->out_state.length;
|
p->actual_length = s->out_state.length;
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
Loading…
Reference in New Issue