Exemple #1
0
static int recv_from_unipro(unsigned int cportid, void *payload, size_t len)
{
    char *buf;
    int ret;

    len = gb_packet_size(payload);

    buf = malloc(len + 1);
    if (!buf)
        return -ENOMEM;

    gb_dump(payload, len);

    /*
     * TODO
     * Update UniPro driver to allocate a buffer that can contain
     * the cport number and the data in order to avoid the recopy.
     */
    memcpy(buf, &cportid, 1);
    memcpy(buf + 1, payload, len);
    ret = unipro_to_usb(g_usbdev, buf, len + 1);

    free(buf);

    return ret;
}
Exemple #2
0
static int usb_to_unipro(struct apbridge_dev_s *dev,
                         void *payload, size_t size)
{
    struct cport_msg *cmsg = (struct cport_msg *)payload;

    gb_dump(cmsg->data, size - 1);

    return unipro_send(cmsg->cport, cmsg->data, size - 1);
}
Exemple #3
0
static int usb_to_unipro(struct apbridge_dev_s *dev, unsigned cportid,
                         void *buf, size_t len)
{
    gb_dump(buf, len);

    if (len < sizeof(struct gb_operation_hdr))
        return -EPROTO;

    return apbridge_backend.usb_to_unipro(cportid, buf, len,
                                          release_buffer, dev);
}
Exemple #4
0
int recv_from_unipro(unsigned int cportid, void *buf, size_t len)
{
    /*
     * FIXME: Remove when UniPro driver provides the actual buffer length.
     */
    len = gb_packet_size(buf);

    gb_dump(buf, len);

    if (len < sizeof(struct gb_operation_hdr))
        return -EPROTO;

    return unipro_to_usb(g_usbdev, cportid, buf, len);
}
Exemple #5
0
static int recv_from_svc(void *buf, size_t length)
{
  gb_dump(buf, length);

  return svc_to_usb(g_usbdev, buf, length);
}
Exemple #6
0
static int usb_to_svc(struct apbridge_dev_s *dev, void *payload, size_t size)
{
  gb_dump(payload, size);

  return svc_handle(payload, size);
}