All pastes #88795 Raw Edit

Mine

public text v1 · immutable
#88795 ·published 2006-07-15 09:53 UTC
rendered paste body
/*
struct OutputValues
{
	TCHAR szType[50];
	TCHAR szAction[50];
	BYTE byteValues[10];
	int iArrayElements;
};

OutputValues m_ValuesOnOut;
*/
//usb_control_msg(usb_dev_handle *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout);
void CUsbMouseOut::SendActionOn(void)
{
	TCHAR buf[255];
	_stprintf(buf,_T("SendAction before: %i\r\n"),m_ValuesOnOut.byteValues[0]);//OK 16
	OutputDebugString(buf);
	usb_control_msg(m_pDeviceHandle,m_dwRequesttype,m_dwRequest,m_dwValue,m_dwIndex,(char *)&m_ValuesOnOut.byteValues[0],m_ValuesOnOut.iArrayElements,m_dwTimout);
	_stprintf(buf,_T("SendAction after: %i\r\n"),m_ValuesOnOut.byteValues[0]);//WTF??? 232
	OutputDebugString(buf);
	
	if(m_bSendConfirm==true)
		usb_control_msg(m_pDeviceHandle,m_dwRequesttype,m_dwRequest,m_dwValue,m_dwIndex,(char *)&m_ValuesConfirm.byteValues[0],m_ValuesConfirm.iArrayElements,m_dwTimout);
}

int usb_control_msg(usb_dev_handle *dev, int requesttype, int request,
	int value, int index, char *bytes, int size, int timeout)
{
  struct usb_ctrltransfer ctrl;
  int ret;

  ctrl.bRequestType = requesttype;
  ctrl.bRequest = request;
  ctrl.wValue = value;
  ctrl.wIndex = index;
  ctrl.wLength = size;

  ctrl.data = bytes;
  ctrl.timeout = timeout;

  ret = ioctl(dev->fd, IOCTL_USB_CONTROL, &ctrl);
  if (ret < 0)
    USB_ERROR_STR(-errno, "error sending control message: %s", strerror(errno));

  return ret;
}