@@ -27,7 +27,6 @@ along with this program. If not, see <h
#include "smscoreapi.h"
#include "sms-cards.h"
-
#include "smsendian.h"
#define USB1_BUFFER_SIZE 0x1000
@@ -64,7 +63,7 @@ static void smsusb_onresponse(struct urb
static void smsusb_onresponse(struct urb *urb, struct pt_regs *regs)
#endif
{
- struct smsusb_urb_t *surb = (struct smsusb_urb_t *) urb->context;
+ struct smsusb_urb_t *surb = (struct smsusb_urb_t *)urb->context;
struct smsusb_device_t *dev = surb->dev;
if (urb->status < 0) {
@@ -76,6 +75,7 @@ static void smsusb_onresponse(struct urb
if (urb->actual_length > 0) {
struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)surb->cb->p;
+ smsendian_handle_message_header(phdr);
if (urb->actual_length >= phdr->msgLength) {
surb->cb->size = phdr->msgLength;
@@ -179,6 +179,7 @@ static int smsusb_sendrequest(void *cont
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);
}
@@ -336,8 +337,8 @@ static int smsusb_init_device(struct usb
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;
@@ -532,13 +533,12 @@ MODULE_DEVICE_TABLE(usb, smsusb_id_table
MODULE_DEVICE_TABLE(usb, smsusb_id_table);
static struct usb_driver smsusb_driver = {
- .name = "smsusb",
- .probe = smsusb_probe,
- .disconnect = smsusb_disconnect,
- .id_table = smsusb_id_table,
-
- .suspend = smsusb_suspend,
- .resume = smsusb_resume,
+ .name = "smsusb",
+ .probe = smsusb_probe,
+ .disconnect = smsusb_disconnect,
+ .suspend = smsusb_suspend,
+ .resume = smsusb_resume,
+ .id_table = smsusb_id_table,
};
int smsusb_register(void)