We where allocating the dialid and acceptid using:
rand()<<16 + rand()
this gives a biased values as rand() retuns a 15-bit
number. Instead, use two calls to nrand() to get
the full 32-bit unsigned range.
the start generation was allocated by calling rand(),
which gives a value between 0 and 2^15.
Instead, make a newgen() function that returns a new
generation id in the full 32-bit range, but also
avoids 0 and Hangupgen special values.
Cleanup and make all helper functions static.
Using > causes the kbmap file to get truncated,
which resets to the default keymap and *THEN*
applies the new change. Which is probably not
what was intended.
The default behaviour of the key labelled as Caps Lock is
to be a Ctrl key, but in some cases in can be desirable
to have it like an actual Caps Lock. A new kbmap file is
added and the keyboard documentation is updated.
git/commit /sys/lib/kbmap/caps /sys/man/6/keybo
We used to only allow a single report per interface,
ignoring queries if a interfce already had a report
in flight.
However, this is not correct. Imagine if there is
a query specific query for a group, we add the
report and then we will ignore all further
queries (general or specific) until that
report times out.
Instead, we should maintain the timeout (report)
for each group (and interface) individually.
This means, Report.multi must point to a *single*
Ipmulti. When we handle general queries,
we must create individual Reports for
each of our multicast addresses, but check if
such a report already exists (for that interface).
Because the individual check is basically
quadratic, organise the reports in a hash table
to make finding the existing reports per group
per interface cheaper.
The semacquire allocates a Rendez struct on its stack,
and publishes it on the semaphore linked list in the
segment.
Before returning, it removes it again, properly taking
the locks protecting the linked list, so whats the issue?
The issue happens when procinterrupt() does the wakeup,
which does not care about the spinlock of the segment
lined list, and it does it in the following way:
p->r = nil;
r->p = nil;
ready(p);
unlock(r);
Note that the unlock happens *after* the ready.
So the process could'v already run on another core, remove
itself from the segment list and get out of semacquire()
alltogether, but we still have one line to execute here,
which is the unlock() of the now free'd Rendez.
And that was causing the stack corruption!
So wakeup() and procinterrupt() always had this issue.
If the Rendez memory stays valid after the wakeup,
here is no issue. Most code just uses &up->sleep,
which will stay valid as Proc's are never freed.
The solution for now is to do the ready() as the
last step, not touching the resource after the final
unlock.
up->nerrlab is initialized to zero in newproc(),
and we make sure that the syscall handler returns
with up->nerrlan == 0 as well.
If we are paranoid, we can put a check in kenter().
I have a edirol usb 1.1 soundcard:
ep4.0: audio csp 0x000101 vid 0x08bb did 0x2902 'Burr-Brown from TI ' 'USB Audio CODEC ' 76dd2 xhci
Recent code changes produce the following errors
and seems to leave some volume controls empty,
causing later a division by zero crash.
getvalue: mute: cur: Stall Error
getvalue: volume: cur: Stall Error
getvalue: volume: cur: Stall Error
...
audio 269: suicide: sys: trap: divide error pc=0x201b25
The device doesnt appear to have digital
volume controls or anything so i'm not really
interested in getting it to work :)
Just getting rid of the crash. The device works
otherwise fine:
% for(i in /dev/audioctlU* /dev/audiostatU*){echo $i; cat $i;}
/dev/audioctlU76dd2
out on
in on
/dev/audiostatU76dd2
bufsize 0 buffered 0
fmtout u8c1r32000 u8c1r44100 u8c1r48000 u8c2r32000 u8c2r44100 u8c2r48000 s8c1r32000 s8c1r44100 s8c1r48000 s8c2r32000 s8c2r44100 s8c2r48000 s16c1r32000 s16c1r44100 s16c1r48000 s16c2r32000 s16c2r44100 s16c2r48000
fmtin s8c1r11025 s8c2r11025 s16c1r11025 s16c2r11025 s8c1r8000 s8c2r8000 s8c1r16000 s8c2r16000 s16c1r16000 s16c2r16000 s16c1r22050 s16c2r22050 s16c1r32000 s16c2r32000 s16c1r44100 s16c2r44100 s16c1r48000 s16c2r48000
* copy _callmain structure from libc
* assembly functions without a prelude can not be profiled
* add missing files for profiling on some archs
* reduce minor style differences between ape/libc profile code
This is pleminary work of replacing "speed" with "fmtout"/"fmtin"
through the entire system.
Switching between output devices with different PCM formats
back and forth now works as expected.
To implement keyboard input timeout, we used
to poll the keyboard in a loop with a 100ms
sleep in between using INT 0x15 WAIT BIOS call.
But it seems iPXE breaks the BIOS call, making
it just hang.
The BIOS has a 32-bit tick counter at
040:006C that has a period of 54.9254ms.
Using that instead of the WAIT call appears to be
more reliable and makes it work in iPXE.
Implementation note:
Because the counter has a wrap around value
at non-power-of-two, only check if the counter changed
and counting down the millisecond timeout when it did.
When the interface is specified as "-",
we should find the interface based on
the gateway and source ip.
As another improvement, also allow
specifying the interface as the bound
device name (for example "/net/ether0").
- automatically choose configuration with the format closest to the
s16c2r44100
- allow independent in/out formats to be configured (mono mic with
lower rate will work)
- provide "fmtout" and "fmtin" via /dev/volumeU*; those can be changed
by writing to /dev/volumeU*
- expose some of the useful controls (volume, mute etc), if available,
via /dev/volumeU
- add "in on/off" and "out on/off" via /dev/audioctlU* for
input/output toggling, which helps with headsets that force low
quality on both
- expose supported intput/output formats via /dev/audiostatU*
Tested with:
- vid 0x1b3f did 0x2008 GeneralPlus 'USB Audio Device'
(audio 1.0, in + out)
- vid 0x14ed did 0x3004 Shure 'Shure AONIC 50 USB Hi-Res'
(audio 2.0, out only)
- vid 0x14ed did 0x3003 'Shure Inc' 'Shure AONIC 50 USB'
(audio 1.0, headset, in + out)
Known issues:
- on MNT Reform, changing rate to 48kHz on GeneralPlus results in
silence on the output if the device is connected to either of the
closest (to the user) usb ports; it works well with the one closer to
the back
full speed assumes 1ms between the frames, but with high
speeds the (micro)frames are 125us between.
Adjust accordingly.
This fixed playback on my usb audio 2.0 headset connected
to Reform's xhci hub port.
This patch implements two specific behaviors of Dubeolsik layout.
dubeollkup function makes Jongseong(final consonant) to be treated as
Choseong(initial consonant) when possible. For example, QWERTY input
"zhem" in Dubeolsik has to be "코드", not "콛ㅡ" where switched
Jongseong is "ㄷ".
dubeolbksp function emits out syllable remaining after single
backspace. So when user presses backspace on "코드", the expected output
is "코ㄷ", still allowing user to edit latter syllable, rather than
"코" without dubeolbksp. This should only apply to last syllable
considering it's de facto in Dubeolsik implementations.
* scrollbar and mouse selection of candidate
* arrow keys for moving selection cursor after first completion
* user defined dictionaries that are merged on top
* document using the plumber to change languages
* loop candidates when reaching the start/end of the list.
* skk2ktrans was using the wrong from encoding
On modern machines, doing a empty loop
is too fast, resulting in us using the
maximum loopconst of 1000000 and getting
wrong delay() timings.
To fix the timings, use a chain of IDIVQ
instructions instead.
The loop timings is going to be measured
using the TSC, so the exact timing doesnt
need to be known.
Rename aamloop() to delayloop() as it does
different things depending on 386 or amd64.
Both qflush() and qdiscard() appear to
be interrupt level, and must not call
the kick routine of the queue, see
the deadlock in tcp:
0xffffffff80f2fb10 304: loopbackread cinap_lenrek pc 0xffffffff8019a053 kproc (Queueing) ut 0 st 1959 qpc 0xffffffff8014f98e
gotolabel()+0x0 /sys/src/9/pc64/l.s:573
procswitch()+0x50 /sys/src/9/port/proc.c:161
sched()+0xed /sys/src/9/port/proc.c:214
qlock(q=0xffffffff8283ab48)+0x14f /sys/src/9/port/qlock.c:108
tcpkick()+0x5a /sys/src/9/ip/tcp.c:593
iunlock_reader(q=0xffffffff820d1e48)+0x3b /sys/src/9/port/qio.c:480
qdiscard(q=0xffffffff820d1e48,len=0xffffffff00000001)+0x53 /sys/src/9/port/qio.c:1188
update(seg=0xffffffff80f2f968,s=0xffffffff8283ab48)+0x16b /sys/src/9/ip/tcp.c:2032
tcpiput(tcp=0xffffffff809ea2b8,bp=0xffffffff823150c8,ifc=0xffffffff80f39850)+0x1107 /sys/src/9/ip/tcp.c:2387
ipmuxiput(bp=0xffffffff823150c8,ifc=0xffffffff80f39850)+0xa6 /sys/src/9/ip/ipmux.c:765
ipiput4(bp=0xffffffff823150c8,ifc=0xffffffff80f39850,f=0xffffffff809ef7f8)+0x5d9 /sys/src/9/ip/ip.c:408
loopbackread()+0x100 /sys/src/9/ip/loopbackmedium.c:100
linkproc()+0x19 /sys/src/9/port/proc.c:1569