gisi: fix pipe create request endianess problems
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Wed, 19 Aug 2009 15:07:39 +0000 (18:07 +0300)
committerAki Niemi <aki.niemi@nokia.com>
Wed, 19 Aug 2009 15:16:07 +0000 (18:16 +0300)
gisi/pipe.c

index f4c8231..250f113 100644 (file)
 #define PN_PIPE        0xd9
 
 typedef struct {
-       uint8_t dummy;
        uint8_t cmd;
        uint8_t state_after;
        uint8_t priority;
 
-       uint16_t object1;
+       uint8_t device1;
+       uint8_t object1;
        uint8_t type1;
        uint8_t pad;
 
-       uint16_t object2;
+       uint8_t device2;
+       uint8_t object2;
        uint8_t type2;
        uint8_t n_sb;
-} _isi_pipe_create_req_t;
+} isi_pipe_create_req_t;
 
 typedef struct {
        uint8_t cmd;
@@ -199,13 +200,15 @@ GIsiPipe *g_isi_pipe_create(GIsiModem *modem, void (*created)(GIsiPipe *),
                                uint16_t obj1, uint16_t obj2,
                                uint8_t type1, uint8_t type2)
 {
-       _isi_pipe_create_req_t msg = {
+       isi_pipe_create_req_t msg = {
                .cmd = PNS_PIPE_CREATE_REQ,
                .state_after = PN_PIPE_DISABLE,
                .priority = PN_MSG_PRIORITY_LOW,
-               .object1 = obj1,
+               .device1 = obj1 >> 8,
+               .object1 = obj1 & 0xff,
                .type1 = type1,
-               .object2 = obj2,
+               .device2 = obj2 >> 8,
+               .object2 = obj2 & 0xff,
                .type2 = type2,
                .n_sb = 0,
        };
@@ -220,7 +223,7 @@ GIsiPipe *g_isi_pipe_create(GIsiModem *modem, void (*created)(GIsiPipe *),
        pipe->handle = PN_PIPE_INVALID_HANDLE;
 
        if (pipe->client == NULL ||
-           g_isi_request_make(pipe->client, &msg.cmd, sizeof(msg) - 1, 3,
+           g_isi_request_make(pipe->client, &msg, sizeof(msg), 3,
                                g_isi_pipe_created, pipe) == NULL)
                goto error;