* sony-laptop: fix SNC buffer calls when SN06 returns Integers
@ 2012-12-18 7:08 Zhang Rui
2012-12-18 21:39 ` Mattia Dongili
0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2012-12-18 7:08 UTC (permalink / raw)
To: platform-driver-x86@vger.kernel.org, malattia; +Cc: Zhang, Rui
Hi, Mattia,
I saw your fix for the SN06 Integer return value issue at
http://www.spinics.net/lists/platform-driver-x86/msg03934.html
here is a duplicate bug report at
https://bugzilla.kernel.org/show_bug.cgi?id=50111
I generated a similar patch as yours but I still have one concern about the fix.
memcpy(buffer, (void *)&object->integer.value, len) may break the byte order but
sony_nc_rfkill_setup() terminates if byte 0xff is checked.
is this true? or am I thinking wrong?
thanks,
rui
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sony-laptop: fix SNC buffer calls when SN06 returns Integers
2012-12-18 7:08 sony-laptop: fix SNC buffer calls when SN06 returns Integers Zhang Rui
@ 2012-12-18 21:39 ` Mattia Dongili
2012-12-19 1:00 ` Zhang Rui
0 siblings, 1 reply; 4+ messages in thread
From: Mattia Dongili @ 2012-12-18 21:39 UTC (permalink / raw)
To: Zhang Rui; +Cc: platform-driver-x86@vger.kernel.org
On Tue, Dec 18, 2012 at 03:08:44PM +0800, Zhang Rui wrote:
> Hi, Mattia,
Hi Rui!
> I generated a similar patch as yours but I still have one concern about the fix.
thanks for taking care of that.
> memcpy(buffer, (void *)&object->integer.value, len) may break the byte order but
> sony_nc_rfkill_setup() terminates if byte 0xff is checked.
> is this true? or am I thinking wrong?
You're correct, sony_nc_rfkill_setup() stops looking at the buffer as
soon as it hits 0xff but why do you think memcpy would break the byte
order?
--
mattia
:wq!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sony-laptop: fix SNC buffer calls when SN06 returns Integers
2012-12-18 21:39 ` Mattia Dongili
@ 2012-12-19 1:00 ` Zhang Rui
2012-12-19 22:08 ` Mattia Dongili
0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2012-12-19 1:00 UTC (permalink / raw)
To: Mattia Dongili; +Cc: platform-driver-x86@vger.kernel.org
On Wed, 2012-12-19 at 06:39 +0900, Mattia Dongili wrote:
> On Tue, Dec 18, 2012 at 03:08:44PM +0800, Zhang Rui wrote:
> > Hi, Mattia,
>
> Hi Rui!
>
> > I generated a similar patch as yours but I still have one concern about the fix.
>
> thanks for taking care of that.
>
> > memcpy(buffer, (void *)&object->integer.value, len) may break the byte order but
> > sony_nc_rfkill_setup() terminates if byte 0xff is checked.
> > is this true? or am I thinking wrong?
>
> You're correct, sony_nc_rfkill_setup() stops looking at the buffer as
> soon as it hits 0xff but why do you think memcpy would break the byte
> order?
>
I'm not sure how SN06 works.
say, you have supported codes 0x00, 0x10, and 0x20, what would SN06
return?
0x001020FF00000000 or 0x00000000FF201000?
thanks,
rui
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sony-laptop: fix SNC buffer calls when SN06 returns Integers
2012-12-19 1:00 ` Zhang Rui
@ 2012-12-19 22:08 ` Mattia Dongili
0 siblings, 0 replies; 4+ messages in thread
From: Mattia Dongili @ 2012-12-19 22:08 UTC (permalink / raw)
To: Zhang Rui; +Cc: platform-driver-x86@vger.kernel.org
On Wed, Dec 19, 2012 at 09:00:34AM +0800, Zhang Rui wrote:
> On Wed, 2012-12-19 at 06:39 +0900, Mattia Dongili wrote:
> > On Tue, Dec 18, 2012 at 03:08:44PM +0800, Zhang Rui wrote:
> > > Hi, Mattia,
> >
> > Hi Rui!
> >
> > > I generated a similar patch as yours but I still have one concern about the fix.
> >
> > thanks for taking care of that.
> >
> > > memcpy(buffer, (void *)&object->integer.value, len) may break the byte order but
> > > sony_nc_rfkill_setup() terminates if byte 0xff is checked.
> > > is this true? or am I thinking wrong?
> >
> > You're correct, sony_nc_rfkill_setup() stops looking at the buffer as
> > soon as it hits 0xff but why do you think memcpy would break the byte
> > order?
> >
> I'm not sure how SN06 works.
> say, you have supported codes 0x00, 0x10, and 0x20, what would SN06
> return?
> 0x001020FF00000000 or 0x00000000FF201000?
The return buffer is filled in sequentially and we go through it in the
same way in sony_nc_rfkill_setup(), it should be safe but here's an
example:
Name (BUFF, Buffer (0x0410) {})
CreateDWordField (BUFF, Zero, BUFS)
...
Store (Zero, Local3)
If (WLAP)
{
Store (Zero, Index (BUFF, Local3))
Add (Local3, One, Local3)
}
If (BLTH)
{
Store (0x10, Index (BUFF, Local3))
Add (Local3, One, Local3)
}
If (WNED)
{
Store (0x20, Index (BUFF, Local3))
Add (Local3, One, Local3)
}
Then based on some odd consideration the method may return BUFF or BUFS
and that's where we have to take either integer.value or buffer.pointer.
Thanks!!
--
mattia
:wq!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-19 22:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 7:08 sony-laptop: fix SNC buffer calls when SN06 returns Integers Zhang Rui
2012-12-18 21:39 ` Mattia Dongili
2012-12-19 1:00 ` Zhang Rui
2012-12-19 22:08 ` Mattia Dongili
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox