* Excess spaces in sysfs files
@ 2004-02-25 21:25 Daniel Drake
2004-02-25 22:49 ` Kay Sievers
2004-02-28 0:22 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Drake @ 2004-02-25 21:25 UTC (permalink / raw)
To: linux-hotplug
Hi,
I have met a minor issue when writing udev rules.
Some text-like files in /sys have a load of spaces appended onto the text.
Example below, part of the udevinfo for my camera (notice the model field):
follow the class device's "device"
looking at the device chain at
'/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3/3-3:1.0/host0/0:0:0:0':
BUS="scsi"
ID="0:0:0:0"
SYSFS{detach_state}="0"
SYSFS{max_sectors}="240"
SYSFS{device_blocked}="0"
SYSFS{queue_depth}="1"
SYSFS{type}="0"
SYSFS{scsi_level}="3"
SYSFS{vendor}=" "
SYSFS{model}="USB 2.0M DSC "
SYSFS{rev}="1.00"
SYSFS{online}="1"
Second example, an iPod:
http://marc.theaimsgroup.com/?l=gentoo-user&m\x107773927301652&w=2
Of course, udevinfo makes it nice and clear that the extra spaces are there.
But if you are simply cat'ing the files in /sys its not that obvious.
My questions:
1. Should these spaces be here? Are devices really identifying themselves with
spaces on the end? Or is this an issue with sysfs/similar.
2. Should udev trim whitespace from the end of SYSFS{..} values (files), so
that keys such as
SYSFS{model} = "iPod"
would match a file containing
"iPod "
If the above behaviour is implemented, I would suggest having a second key
type, SYSFS_RAW{..} where whitespace is not trimmed. I am prepared to write a
patch for this.
Daniel.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Excess spaces in sysfs files
2004-02-25 21:25 Excess spaces in sysfs files Daniel Drake
@ 2004-02-25 22:49 ` Kay Sievers
2004-02-28 0:22 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Kay Sievers @ 2004-02-25 22:49 UTC (permalink / raw)
To: linux-hotplug
On Wed, 2004-02-25 at 22:25, Daniel Drake wrote:
> 1. Should these spaces be here? Are devices really identifying themselves with
> spaces on the end? Or is this an issue with sysfs/similar.
It's common. Seems like vendors are just filling fixed length fields.
A lot of fields are 8 characters total length.
> 2. Should udev trim whitespace from the end of SYSFS{..} values (files), so
> that keys such as
> SYSFS{model} = "iPod"
> would match a file containing
> "iPod "
>
> If the above behaviour is implemented, I would suggest having a second key
> type, SYSFS_RAW{..} where whitespace is not trimmed. I am prepared to write a
> patch for this.
Hey, udevinfo is so cute :)
I don't like the idea to try to be smart with the matching, but if we
really want this, I prefer to have it configurable in the config file.
thanks,
Kay
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Excess spaces in sysfs files
2004-02-25 21:25 Excess spaces in sysfs files Daniel Drake
2004-02-25 22:49 ` Kay Sievers
@ 2004-02-28 0:22 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2004-02-28 0:22 UTC (permalink / raw)
To: linux-hotplug
On Wed, Feb 25, 2004 at 09:25:16PM +0000, Daniel Drake wrote:
> 1. Should these spaces be here? Are devices really identifying themselves
> with spaces on the end? Or is this an issue with sysfs/similar.
This is a device issue. Seems like a lot of them have spaces in odd
places. Nothing sysfs or udev can do about it.
Go complain to the device manufacturer :)
> 2. Should udev trim whitespace from the end of SYSFS{..} values
> (files), so that keys such as
> SYSFS{model} = "iPod"
> would match a file containing
> "iPod "
No, I don't think so. That's one reason udevinfo was created to show
you that those spaces are really there.
thanks,
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-02-28 0:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-25 21:25 Excess spaces in sysfs files Daniel Drake
2004-02-25 22:49 ` Kay Sievers
2004-02-28 0:22 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).