I had kind of the same problem about 1½ ago. I needed to interface with my soundcard and thus needed ioctl. However, there was some argument against adding a general ioctl call, but I'm not sure what it was. I ended up using a tiny cmod for the purpose of setting my parameter.
It might be that there is no real way of knowing what parameters are passed and how they should be interperted on the C-level. But that could be fixed using some smart heuristics, IMHO.
/ Marcus Agehall (PacketFront)
Previous text:
2004-08-17 08:47: Subject: managing comport settings in linux
It seems like that ioctl is missing from Pike. :/
I wonder if ioctl should be added on a general basis, or if special calls should be added for all ioctls...
(crossposting developers list)
Anyhow, it should be added somehow to src/modules/files/termios.c or nearby. It shouldn't be too tricky. If I have time, I'll do it today (so it lands in 7.7-cvs), but if not I'm leaving for austria tomorrow morning, so can't do anything then for some weeks :/
/ Mirar
Not easily. Also, you need all the IOCTL constants somewhere, and those are highly system specific.
It's probably easier to simply implement interfaces as they are needed. As an example, adding a soundcard interface that handles several different output methods (ALSA (spdif and not), Solaris /dev/audio, esd etc) directly.
/ Per Hedbor ()
Previous text:
2004-08-17 08:58: Subject: managing comport settings in linux
I had kind of the same problem about 1½ ago. I needed to interface with my soundcard and thus needed ioctl. However, there was some argument against adding a general ioctl call, but I'm not sure what it was. I ended up using a tiny cmod for the purpose of setting my parameter.
It might be that there is no real way of knowing what parameters are passed and how they should be interperted on the C-level. But that could be fixed using some smart heuristics, IMHO.
/ Marcus Agehall (PacketFront)
What would be nice, is a way to define ioctl methods in Pike. Perhaps something like
object i = Stdio.IOCTL(4242 /* request_id */ ); i->add_int_parameter(); i->add_string_parameter(); i->set_return_type(STRING);
string ret = i(fd, 1, "somestring");
That ought to be possible, or..?
/ Marcus Agehall (PacketFront)
Previous text:
2004-08-17 13:17: Subject: managing comport settings in linux
Not easily. Also, you need all the IOCTL constants somewhere, and those are highly system specific.
It's probably easier to simply implement interfaces as they are needed. As an example, adding a soundcard interface that handles several different output methods (ALSA (spdif and not), Solaris /dev/audio, esd etc) directly.
/ Per Hedbor ()
For what I understand, this is not easily solved by someone like me, without getting knowledge of c-modules.
Do you still have this cmod for your soundcard? May I borrow parts of it for my application?
/Marc
/ Marc Dirix
Previous text:
2004-08-17 08:58: Subject: managing comport settings in linux
I had kind of the same problem about 1½ ago. I needed to interface with my soundcard and thus needed ioctl. However, there was some argument against adding a general ioctl call, but I'm not sure what it was. I ended up using a tiny cmod for the purpose of setting my parameter.
It might be that there is no real way of knowing what parameters are passed and how they should be interperted on the C-level. But that could be fixed using some smart heuristics, IMHO.
/ Marcus Agehall (PacketFront)
Sorry. Lost my CVS-repository to a fsck a few months ago. However, it is not very hard to fix up a cmod that accomplishes what you need.
Look at some (fairly simple) cmod in the pike source and I'm sure you can figure it out. I usually start with the Bz-module, rip out almost everything and then add my stuff. Just copy the post_modules/Bz dir to post_modules/MyIOCTL and start changing... ;)
/ Marcus Agehall (PacketFront)
Previous text:
2004-08-17 14:22: Subject: managing comport settings in linux
For what I understand, this is not easily solved by someone like me, without getting knowledge of c-modules.
Do you still have this cmod for your soundcard? May I borrow parts of it for my application?
/Marc
/ Marc Dirix
pike-devel@lists.lysator.liu.se