Author Message

<  New Ideas  ~  introducing more structure to the config file

PostPosted: Fri Nov 14, 2008 1:25 am Reply with quote
Posts: 8 Joined: Sat Nov 17, 2007 4:12 am Website: http://www.morgwai.pl/
Hi,

What really annoys me in modeswitch is the fact that I either have to edit config file everytime I change the device or I have to have multiple config files (one per device and select it with -c option).

I was thinking about possibility of having multiple configurations in one file labeled somehow so I can specify using some command line option which to use. For example either windows ini file format could be used or xml for config file. As xml parsers are quite heavyweight the first option seems better.

Let me provide a basic example:
assuming the following config file:
Code:
[config1]

DefaultVendor=  0x05c6
DefaultProduct= 0x1000
TargetVendor=   0x0af0
TargetProduct=  0x6600
MessageEndpoint=0x05
MessageContent="55534243123456780000000000000601000000000000000000000000000000"

[config2]

DefaultVendor=  0x05c6
DefaultProduct= 0x1000
TargetVendor=   0x0af0
TargetProduct=  0x6901
MessageEndpoint=0x05
MessageContent="55534243123456780000000000000601000000000000000000000000000000"

I could issue
Code:
# usb_modeswitch -L config1
to use the first configuration and similarly for config2.

To make it backward compatible program would use first found configuration if no -L flag is provided.

What do you think?

Thanks

Morg


Offline
PostPosted: Sun Nov 16, 2008 12:47 am Reply with quote
Site Admin Posts: 6438 Joined: Sat Nov 03, 2007 12:30 am
To be honest, I'm hesitating to support that idea.

I think it would open up all kinds of possibilities for errors if lines are not properly commented in or out.
If I would try and catch all these possible errors it would add to overall complexity, and I am - by instinct and experience - not comfortable with that. And the vast majority of users will never need to switch more than one device.

If I were in your situtation I'd stick with the multiple config file solution. I can organize them in any way I want and instead of saying "usb_modeswitch -L config1" for example issue "usb_modeswitch -c /etc/config1"; is that really less convenient? To change or add devices I'd have to edit the files anyway.

Of course I'd scrap all those comments and other devices from the files in the way you did it.


Offline
PostPosted: Tue Nov 18, 2008 8:25 pm Reply with quote
Posts: 8 Joined: Sat Nov 17, 2007 4:12 am Website: http://www.morgwai.pl/
So the idea behind it is that most users won't have to edit config file at all (they would only use -L cmd line flag). This would probably decrease the actual number of errors caused by wrong config file.

Also it would significantly ease up packaging for general purpose distributions. In current situation I would have to include all these config files for all devices.

What's on my mind is to build configuration tool over usb_modeswitch that would allow picking device from the list ;) It is of course possible to build it with current config schema, but the modification I proposed would make it a bit easier.

Please let me know if this convinces you.

Thanks

Morg


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
3 posts
Users browsing this forum: No registered users and 2 guests
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum