Re: Trying to develop a Pixelsense kernel driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 22 Aug 2013, Florian Echtler wrote:

> Hello everyone,
> 
> I recently wanted to pick up again on developing a kernel input driver
> for the Microsoft Pixelsense (formerly Surface 2.0). I already have a
> working user space driver (see also [1]).
> 
> However - just like last year [2] - I quickly ran into an issue with a
> corrupted device firmware after some brief experimentation with the
> kernel driver, while the user space driver didn't and doesn't show any
> such issues. This happened on two separate Pixelsense devices, with
> different kernel versions.
> 
> So even though userspace and kernel driver look like they perform
> exactly the same operations on the device, there must be some difference
> I don't understand - perhaps libusb does some kind of internal error
> handling which the kernel doesn't do?
> 
> 
> Userspace version:
> 
> // for control commands
> usb_control_msg(handle, 0xC0, cmd, 0x00, index, (char*)buf, len, 1000);
> 
> // for bulk data transfer
> uint8_t buffer[512];
> result = usb_bulk_read( handle, 0x86, (char*)(buffer), sizeof(buffer),
> 1000 );
> 
> 
> Kernel version:
> 
> // for control commands
> #define surface_command(dev, command, index, buffer, size)
> usb_control_msg (dev->usbdev, usb_rcvctrlpipe (dev->usbdev, 0),
> command, USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_IN, 0x00,
> index, buffer, size, 1000)

This isn't equivalent to the userspace version.  Here the recipient is 
USB_RECIP_ENDPOINT, but in the userspace version it is 
USB_RECIP_DEVICE.  To put it another way, here the bRequestType value 
is 0xC2 and there it is 0xC0.

> // for bulk data transfer
> result = usb_bulk_msg (surface->usbdev,
> usb_rcvbulkpipe (surface->usbdev, 0x86),
> surface->bulk_in_buffer, 512, &bulk_read, 1000);

This is equivalent to the version above.

> Can anybody venture a guess what kind of functional difference there is
> between these code snippets?

It's hard to say exactly.  Probably one of the control messages will 
work and the other one won't.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux