Skip to contentSkip to conversation

PATCH: Make sysfs color_map attribute work

PATCH Jon Smirl 2 participants 6 messages Jun 12, 2005 – Jun 23, 2005

Subsystems (2)
lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

These two patches make the sysfs color_map attribute work. There is a minor bug in sysfs fixed by sysfs_offbyone.patch. I sent the sysfs fix separately to GregKH.

Sysfs usually works in text instead of binary. That lets scripts set the attributes. You can set an attribute from a program with normal file writes. The values have to be less than PAGE_SIZE in size.

Color maps have up to 256 entries. 4096/256 allows for 16 characters per line.

The format for a cmap entry is "%02x%c%4x%4x%4x\n" %02x entry %c transp %4x red %4x blue %4x green

You don't have to start at zero, you can change one or more entries this way. Build up a line per entry and set the whole block into the attribute.

You can read the color_map with cat fb0/color_map.

My assumption from looking at the code that transparent is a boolean flag. If the "%c" column is not a space transparent will be set for that entry.

Signature · 2 lines
Jon Smirl
[email protected]
fs/sysfs/file.c +1 -1
@@ -182,7 +182,7 @@ fill_write_buffer(struct sysfs_buffer * 
 		return -ENOMEM;
 
 	if (count >= PAGE_SIZE)
-		count = PAGE_SIZE - 1;
+		count = PAGE_SIZE;
 	error = copy_from_user(buffer->page,buf,count);
 	buffer->needs_read_fill = 1;
 	return error ? -EFAULT : count;
drivers/video/fbsysfs.c +72 -10

102 lines not on this page · raw message

author
#1 lore raw

The patch for sysfs off by one is in GregKH's queue now. This patch has to land after that one is in.

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
#2 lore raw

I will send this patch as soon as the sysfs fix goes in. In fact is that fix in Andrews tree?

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

author
#3 lore raw

sysfs fix is already in mm
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.12/2.6.12-mm1/broken-out/gregkh-driver-sysfs-page_size-check.patch
I think it is just about to go into the main kernel from Greg's recent mail.

Quoted 5 lines · James Simmons

I will send this patch as soon as the sysfs fix goes in. In fact is that fix in Andrews tree?

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
#4 lore raw

Okay.

Quoted 4 lines · Jon Smirl

sysfs fix is already in mm
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.12/2.6.12-mm1/broken-out/gregkh-driver-sysfs-page_size-check.patch
I think it is just about to go into the main kernel from Greg's recent mail.

Quoted 12 lines
Quoted 5 lines · James Simmons

I will send this patch as soon as the sysfs fix goes in. In fact is that fix in Andrews tree?

Signature · 2 lines
Jon Smirl
[email protected]

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

author
#5 lore raw

Sysfs fix is in the mainstream kernel now so there is no dependency for the color_map patch any more.

Quoted 23 lines · James Simmons

Okay.

Quoted 16 lines · Jon Smirl

sysfs fix is already in mm
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.12/2.6.12-mm1/broken-out/gregkh-driver-sysfs-page_size-check.patch
I think it is just about to go into the main kernel from Greg's recent mail.

Quoted 5 lines · James Simmons

I will send this patch as soon as the sysfs fix goes in. In fact is that fix in Andrews tree?

--
Jon Smirl
[email protected]

Signature · 9 lines
Jon Smirl
[email protected]


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click