Re: Documentation request: wscons API

2019-03-30 Thread Leonid Bobrov
On Sat, Mar 30, 2019 at 10:54:21AM -, Stuart Henderson wrote:
> On 2019-03-30, Leonid Bobrov  wrote:
> > On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> >> Hi, dear NetBSD and OpenBSD communities.
> >> 
> >> I need to work with wscons, but I don't want to guess by examples
> >> how to work with it, can you please provide documentation for its
> >> API?
> >
> > Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
> > you are the most recent committers to wscons, you know wscons
> > more than anyone else, so why won't you respond?
> >
> > I had to ask letoram from Arcan for help, but he only knows 3/10
> > of wscons and he had to read kernel source to understand how to
> > work with wscons.
> >
> >
> 
> Docs are often better written by a smart person learning to use
> something (so they identify what they need to learn), reading the
> existing source and asking specific questions where they get stuck, than
> by someone who already knows the area.
> 
> Also: figuring out *what* question to ask will often lead you to the
> answer yourself.
> 

Ok, it makes sense, thank you for an adequate answer.

Right now I'm testing raw keyboard input, but I'd like to get to more
abstract interface (KS_* constants in ) so that
I can conveniently execute code on particular key presses.

I've written a small program and it appears to work:
/* Public domain. */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

int
main(void)
{
int kbdfd = open("/dev/wskbd", O_RDONLY | O_NONBLOCK | O_EXCL);

if (kbdfd == -1) {
printf("Couldn't open /dev/wskbd\n");
return 1;
}

struct wscons_event events[32];
int n;
bool quit = false;

while ((n = read(kbdfd, events, sizeof(events))) != 0) {
if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
printf("Error while reading.\n");
return 1;
}

n /= sizeof(struct wscons_event);

for (int i = 0; i < n; ++i)
if (events[i].type == WSCONS_EVENT_KEY_DOWN) {
int value = events[i].value;

if (value == RAWKEY_q) {
printf("Quit.\n");
quit = true;
break;
} else if (value >= RAWKEY_1
&& value <= RAWKEY_9) {
printf("You pressed number: %c!\n",
value - RAWKEY_1 + '1');
} else if (value == RAWKEY_0) {
printf("You pressed number: 0!\n");
} else {
/* Nonsense. */
printf("You pressed: %c\n", value);
}
}

if (quit)
break;
}

return 0;
}



Re: Documentation request: wscons API

2019-03-30 Thread whesun
On Sat, Mar 30, 2019 at 1:58:19AM -0600, Theo de Raadt wrote:
> Leonid Bobrov  wrote:
>
> > On Sat, Mar 30, 2019 at 01:47:53AM -0600, Theo de Raadt wrote:
> > > Leonid Bobrov  wrote:
> > >
> > > > On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> > > > > Hi, dear NetBSD and OpenBSD communities.
> > > > >
> > > > > I need to work with wscons, but I don't want to guess by examples
> > > > > how to work with it, can you please provide documentation for its
> > > > > API?
> > > >
> > > > Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
> > > > you are the most recent committers to wscons, you know wscons
> > > > more than anyone else, so why won't you respond?
> > > >
> > > > I had to ask letoram from Arcan for help, but he only knows 3/10
> > > > of wscons and he had to read kernel source to understand how to
> > > > work with wscons.
> > >
> > > I can only speak for myself:
> > >
> > > I don't owe you anything, and your feelings of entitlement are
> > > worthless around here.
> > >
> >
> > You better say "I don't owe entire community anything" because
> > documentation is important not only for me.
> >
> > As I understand your answer is "if you want documentation, write
> > it yourself"?
>
> Why would I suggest that since it appears you are incapable and only
> know how to complain.

Theo, you're showing your irresponsibility. You went off topic and said
for yourself when mazocomp asked community. It shows what kind of leader
you are. Are you not a part of community now?

You blame us being incapable and being only able to complain, but you're
obstructing yourself. Even third-party developer is more helpful. I will
laugh if third-party developer is more competent than you are.

You're offended baby. You're ready to leave entire community without
documentation for important part of operating system because you're
offended by one person. Currently wscons is like legacy.



Re: Documentation request: wscons API

2019-03-30 Thread Stuart Henderson
On 2019-03-30, Leonid Bobrov  wrote:
> On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
>> Hi, dear NetBSD and OpenBSD communities.
>> 
>> I need to work with wscons, but I don't want to guess by examples
>> how to work with it, can you please provide documentation for its
>> API?
>
> Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
> you are the most recent committers to wscons, you know wscons
> more than anyone else, so why won't you respond?
>
> I had to ask letoram from Arcan for help, but he only knows 3/10
> of wscons and he had to read kernel source to understand how to
> work with wscons.
>
>

Docs are often better written by a smart person learning to use
something (so they identify what they need to learn), reading the
existing source and asking specific questions where they get stuck, than
by someone who already knows the area.

Also: figuring out *what* question to ask will often lead you to the
answer yourself.



Re: Documentation request: wscons API

2019-03-30 Thread Theo de Raadt
Leonid Bobrov  wrote:

> On Sat, Mar 30, 2019 at 01:47:53AM -0600, Theo de Raadt wrote:
> > Leonid Bobrov  wrote:
> > 
> > > On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> > > > Hi, dear NetBSD and OpenBSD communities.
> > > > 
> > > > I need to work with wscons, but I don't want to guess by examples
> > > > how to work with it, can you please provide documentation for its
> > > > API?
> > > 
> > > Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
> > > you are the most recent committers to wscons, you know wscons
> > > more than anyone else, so why won't you respond?
> > > 
> > > I had to ask letoram from Arcan for help, but he only knows 3/10
> > > of wscons and he had to read kernel source to understand how to
> > > work with wscons.
> > 
> > I can only speak for myself:
> > 
> > I don't owe you anything, and your feelings of entitlement are
> > worthless around here.
> > 
> 
> You better say "I don't owe entire community anything" because
> documentation is important not only for me.
> 
> As I understand your answer is "if you want documentation, write
> it yourself"?

Why would I suggest that since it appears you are incapable and only
know how to complain.



Re: Documentation request: wscons API

2019-03-30 Thread Leonid Bobrov
On Sat, Mar 30, 2019 at 01:47:53AM -0600, Theo de Raadt wrote:
> Leonid Bobrov  wrote:
> 
> > On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> > > Hi, dear NetBSD and OpenBSD communities.
> > > 
> > > I need to work with wscons, but I don't want to guess by examples
> > > how to work with it, can you please provide documentation for its
> > > API?
> > 
> > Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
> > you are the most recent committers to wscons, you know wscons
> > more than anyone else, so why won't you respond?
> > 
> > I had to ask letoram from Arcan for help, but he only knows 3/10
> > of wscons and he had to read kernel source to understand how to
> > work with wscons.
> 
> I can only speak for myself:
> 
> I don't owe you anything, and your feelings of entitlement are
> worthless around here.
> 

You better say "I don't owe entire community anything" because
documentation is important not only for me.

As I understand your answer is "if you want documentation, write
it yourself"?



Re: Documentation request: wscons API

2019-03-30 Thread Theo de Raadt
Leonid Bobrov  wrote:

> On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> > Hi, dear NetBSD and OpenBSD communities.
> > 
> > I need to work with wscons, but I don't want to guess by examples
> > how to work with it, can you please provide documentation for its
> > API?
> 
> Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
> you are the most recent committers to wscons, you know wscons
> more than anyone else, so why won't you respond?
> 
> I had to ask letoram from Arcan for help, but he only knows 3/10
> of wscons and he had to read kernel source to understand how to
> work with wscons.

I can only speak for myself:

I don't owe you anything, and your feelings of entitlement are
worthless around here.



Re: Documentation request: wscons API

2019-03-30 Thread Leonid Bobrov
On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> Hi, dear NetBSD and OpenBSD communities.
> 
> I need to work with wscons, but I don't want to guess by examples
> how to work with it, can you please provide documentation for its
> API?

Theo, Ulf, Anton, Todd, Martin, Frederic, Jasper and Jonathan,
you are the most recent committers to wscons, you know wscons
more than anyone else, so why won't you respond?

I had to ask letoram from Arcan for help, but he only knows 3/10
of wscons and he had to read kernel source to understand how to
work with wscons.



Re: Documentation request: wscons API

2019-03-27 Thread Leonid Bobrov
On Tue, Mar 26, 2019 at 11:11:30AM +0200, Leonid Bobrov wrote:
> On Tue, Mar 26, 2019 at 10:04:02AM +0100, Martin Husemann wrote:
> > On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> > > Hi, dear NetBSD and OpenBSD communities.
> > > 
> > > I need to work with wscons, but I don't want to guess by examples
> > > how to work with it, can you please provide documentation for its
> > > API?
> > 
> > Please avoid such cross-postings. Also you did not ask very concrete,
> > so probably expected answer:
> > 
> > man 9 wscons
> > 
> 
> Oh, I miss that one in OpenBSD, thank you.
> 
> And sorry for cross-postings, I was sure it's worth to send to
> multiple lists.
> 
> > Martin

Hold on, it doesn't mension how to handle input, it only says
how to create input, that documentation is for writing keyboard
drivers, but I need actual input handling.



Re: Documentation request: wscons API

2019-03-26 Thread Leonid Bobrov
On Tue, Mar 26, 2019 at 10:04:02AM +0100, Martin Husemann wrote:
> On Tue, Mar 26, 2019 at 10:51:35AM +0200, Leonid Bobrov wrote:
> > Hi, dear NetBSD and OpenBSD communities.
> > 
> > I need to work with wscons, but I don't want to guess by examples
> > how to work with it, can you please provide documentation for its
> > API?
> 
> Please avoid such cross-postings. Also you did not ask very concrete,
> so probably expected answer:
> 
>   man 9 wscons
> 

Oh, I miss that one in OpenBSD, thank you.

And sorry for cross-postings, I was sure it's worth to send to
multiple lists.

> Martin