qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v23 05/11] ccid: add passthru card device


From: Alon Levy
Subject: Re: [Qemu-devel] [PATCH v23 05/11] ccid: add passthru card device
Date: Mon, 28 Mar 2011 14:14:53 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Mar 28, 2011 at 02:08:45PM +0200, Jes Sorensen wrote:
> On 03/23/11 14:19, Alon Levy wrote:
> > The passthru ccid card is a device sitting on the usb-ccid bus and
> > using a chardevice to communicate with a remote device using the
> > VSCard protocol defined in libcacard/vscard_common.h
> > 
> > Usage docs available in following patch in docs/ccid.txt
> > 
> > Signed-off-by: Alon Levy <address@hidden>
> > 
> > ---
> [snip]
> 
> > +static void ccid_card_vscard_send_error(PassthruState *s,
> > +                    uint32_t reader_id, VSCErrorCode code)
> > +{
> > +    VSCMsgError msg = {.code = htonl(code)};
> > +
> > +    ccid_card_vscard_send_msg(
> > +        s, VSC_Error, reader_id, (uint8_t *)&msg, sizeof(msg));
> > +}
> > +
> > +static void ccid_card_vscard_send_init(PassthruState *s)
> > +{
> > +    VSCMsgInit msg = {
> > +        .version = htonl(VSCARD_VERSION),
> > +        .magic = VSCARD_MAGIC,
> > +        .capabilities = {0}
> > +    };
> > +
> 
> If this goes over the wire, don't you need to htonl(VSCARD_MAGIC) here
> if someone tries to run passthrough from a big endian system to a little
> endian system, or vice versa?

The VSCARD_MAGIC definition is actually a cast of a string, so it is already
in the correct byte order:

libcacard/vscard_common.h:#define VSCARD_MAGIC (*(uint32_t *)"VSCD")

> 
> Otherwise it looks ok to me.
> 
> Cheers,
> Jes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]