V4L/DVB (11777): Siano: smsusb - handle byte ordering and big endianity
authorUri Shkolnik <uris@siano-ms.com>
Tue, 12 May 2009 11:24:07 +0000 (08:24 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 22:14:26 +0000 (19:14 -0300)
This patch adds support for byte ordering and big endianity
handling for the USB interface driver

Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/siano/smsusb.c

index ad80366..1bcd0ef 100644 (file)
@@ -26,6 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "smscoreapi.h"
 #include "sms-cards.h"
+#include "smsendian.h"
 
 static int sms_dbg;
 module_param_named(debug, sms_dbg, int, 0644);
@@ -177,6 +178,7 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size)
        struct smsusb_device_t *dev = (struct smsusb_device_t *) context;
        int dummy;
 
+       smsendian_handle_message_header((struct SmsMsgHdr_ST *)buffer);
        return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
                            buffer, size, &dummy, 1000);
 }
@@ -334,8 +336,8 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
        case SMS_VEGA:
                dev->buffer_size = USB2_BUFFER_SIZE;
                dev->response_alignment =
-                       dev->udev->ep_in[1]->desc.wMaxPacketSize -
-                       sizeof(struct SmsMsgHdr_ST);
+                   le16_to_cpu(dev->udev->ep_in[1]->desc.wMaxPacketSize) -
+                   sizeof(struct SmsMsgHdr_ST);
 
                params.flags |= SMS_DEVICE_FAMILY2;
                break;