Opened 16 months ago

Last modified 12 months ago

#18483 new bug

custom speeds in termios is broken

Reported by: pulkomandy Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/libroot.so Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Our lowlevel code allows to set custom speeds for serial ports. This works from BSerialPort, but it doesn't work well from termios because speed_t is defined as a unsigned char, and so, we can't store values above 255 into it. cfseti/ospeed tries to do that.

I think we could change speed_t to be an unsigned int instead to fix this, and it wouldn't break the cfset/geti/ospeed APIs too much (being C APIs). But we can't really fit the speeds inside the termios structure without breaking BeOS compatibility.

Would it be ok to change it only for new gcc versions? All things using termios will still have to be rebuilt.

Change History (6)

comment:1 by waddlesplash, 16 months ago

Why not just use some versioned symbols?

comment:2 by waddlesplash, 16 months ago

There will be an awful lot of things using termios, so using versioned symbols (or even just a remapping #define without formally versioned symbols) seems to make sense, so we don't have to go through a "full" ABI break.

comment:3 by pulkomandy, 16 months ago

I'm not sure what we can do with symbol versionning. The problem will be wih apps allocating termios structures on the stack, and I don't think we can symbol version that?

comment:4 by waddlesplash, 16 months ago

No, we can instead symbol-version all functions that take termios structures and use that to detect whether the passed termios structure is the old size or the new one.

comment:5 by pulkomandy, 12 months ago

I wrote that custom would work with BSerialPort. That's not right, of course, BSerialPort is built on top of cfsetspeed, so it is broken too.

I think I have a way to fit most custom speeds in the existing structure, with a few restrictions. I will implement that and hopefully it will be enough for now.

Note: See TracTickets for help on using tickets.