10pad_t *
pad_open(
unsigned int port,
unsigned int slot,
unsigned int mode,
unsigned int lock)
15 pad->buffer = (
char*)memalign(64,256);
60 pad->type = PAD_TYPE_DIGITAL;
90 if (pad->actuator != NULL)
112void pad_print_state(
pad_t* pad)
115 char stateString[16];
117 padStateInt2String(pad->state,stateString);
118 printf(
"Pad(%d,%d) state is: %s\n",pad->port,pad->slot,stateString);
127 if (pad->state != pad->last_state)
130 pad_print_state(pad);
132 pad->last_state = pad->state;
136 if (pad->state == PAD_STATE_STABLE)
return;
137 if (pad->state == PAD_STATE_ERROR)
return;
138 if (pad->state == PAD_STATE_DISCONN)
return;
139 if (pad->state == PAD_STATE_FINDCTP1)
return;
148 pad->num_modes =
padInfoMode(pad->port,pad->slot,PAD_MODETABLE,-1);
150 return pad->num_modes;
154void pad_print_supported_modes(
pad_t *pad)
159 printf(
"The device has %d modes\n", modes);
167 for (i = 0; i < modes; i++)
169 printf(
"%d ",
padInfoMode(0, 0, PAD_MODETABLE, i));
183 if (pad->num_modes < 0)
188 if ((pad->num_modes == 0) && (type == PAD_TYPE_DIGITAL))
193 for (i = 0; i < pad->num_modes; i++)
195 if (
padInfoMode(pad->port,pad->slot,PAD_MODETABLE,i) == type)
209 pad->type =
padInfoMode(pad->port,pad->slot,PAD_MODECURID,0);
220 if (lock == PAD_MMODE_LOCK)
226 pad->lock = PAD_MMODE_UNLOCK;
229 if ((mode == PAD_MMODE_DUALSHOCK) || (mode == PAD_TYPE_DUALSHOCK))
238 pad->mode = PAD_MMODE_DUALSHOCK;
250 pad->mode = PAD_MMODE_DIGITAL;
267 pad->sensitivity = 1;
272 pad->sensitivity = 0;
291 if (pad->actuator == NULL)
296 if (
padInfoMode(pad->port,pad->slot,PAD_MODECUREXID,0))
309 pad->actuator->small = 0;
310 pad->actuator->large = 0x00;
312 pad->actuator->status[0] = 0;
313 pad->actuator->status[1] = 1;
314 pad->actuator->status[2] = 0xFF;
315 pad->actuator->status[3] = 0xFF;
316 pad->actuator->status[4] = 0xFF;
317 pad->actuator->status[5] = 0xFF;
331 pad->actuator->small = small;
335 pad->actuator->small = 0x01;
338 pad->actuator->large = large;
340 pad->actuator->status[0] = pad->actuator->small;
341 pad->actuator->status[1] = pad->actuator->large;
int mtapGetConnection(int port)
int padPortOpen(int port, int slot, void *padArea)
int padSetActAlign(int port, int slot, const char act_align[6])
int padInfoMode(int port, int slot, int infoMode, int index)
int padExitPressMode(int port, int slot)
int padSetActDirect(int port, int slot, char act_align[6])
int padPortClose(int port, int slot)
int padGetState(int port, int slot)
unsigned char padInfoAct(int port, int slot, int word, int byte)
int padInfoPressMode(int port, int slot)
int padSetMainMode(int port, int slot, int mode, int lock)
int padEnterPressMode(int port, int slot)