Re: [9fans] cpu temp in drawterm

2023-02-14 Thread Skip Tavakkolian
Cool! Thanks.

FYI, the patch is in http://9legacy.org/patch.html, but not on sources
(not applied to pc/devarch.c and not in the patch directory)

On Tue, Feb 14, 2023 at 2:06 PM David du Colombier <0in...@gmail.com> wrote:
> 
> 9legacy supports temperature reporting on x86, using /dev/cputemp.
> 
> --
> David du Colombier

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc8476d0fe749cf6c-M032adb2bef6abb8bcc189e8c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


[9fans] Re: USB Audio on RPi 4

2023-02-14 Thread adr

On Mon, 13 Feb 2023, Steve Taylor wrote:


From: Steve Taylor 
Hello adr,

I saw your note on the Plan 9 mailing list about USB audio on the RPi 4 with 
9legacy. By USB audio device, do you mean something like a USB DAC? If so, I 
have spent several hours on this recently. Whenever I play audio through my USB 
DAC connected to my RPi4, using either 9legacy or 9front, I hear pops and other 
small noises like static. I think it is from dropped frames. If I use OpenBSD 
on the same hardware, these issues do not occur. The audio plays perfectly.

Are you seeing issues like this?

I am curious if using a USB DAC which is USB 1.0 would work properly. I 
identified a couple I could try, but they are about 20 years old and difficult 
to find for a decent price. The USB DAC I have now uses xhci.

Thanks,

Steve


Hi Steve,

I'm using this cheap one:

https://aliexpress.com/item/1005001394902427.html

ep6.0 enabled control rw speed full maxpkt 8 pollival 0 samplesz 0 hz 0 hub 3 
port 4 rootport 1 addr 4 busy
audio csp 0x000101 csp 0x000201 csp 0x000201 csp 0x03 vid 0x1b3f did 0x2008 
GeneralPlus 'USB Audio Device' xhci
ep6.5 enabled iso w speed full maxpkt 180 pollival 1 samplesz 4 hz 44100 hub 3 
port 4 rootport 1 addr 4 busy
ep6.6 enabled iso r speed full maxpkt 96 pollival 1 samplesz 2 hz 48000 hub 3 
port 4 rootport 1 addr 4 idle
ep6.3 enabled interrupt r speed full maxpkt 8 pollival 32 samplesz 0 hz 0 hub 3 
port 4 rootport 1 addr 4 busy

It works ok with 9front. If you just need decent audio output from
your pi, I recommend it.

Now about 9legacy. Richard Miller imported the xhci driver from
9front, so I compared them. The only real difference appart from
IN isochronous transfers support is the addition of sample delay
for buffering. This patch makes the already present control in
usb/audio Delay_control an internal one to set this delay. I used
the same default as 9front, 40ms. I can play audio perfectly now.
Also you can change now the sample rate (speed), the code was
reopening the endpoint with openep() every time setspeed() was
called. More work has to be done, but for now I hope this is helpful
for you.

Try increasing the delay with your device.

I'm sharing this with the list.

P.S. The patch is against the repo at github.com/0intro/plan9-contrib.

Regards,
adr

--- /n/downloads/devusb.c   Tue Feb 14 20:42:27 2023
+++ /sys/src/9/bcm/devusb.c Tue Feb 14 11:31:28 2023
@@ -88,6 +88,7 @@
   CMdebugep,  /* debug n (set/clear debug for this ep) */
   CMname, /* name str (show up as #u/name as well) */
   CMtmout,/* timeout n (activate timeouts for ep) */
+   CMsampledelay,  /* maximum delay introduced by buffering (iso) 
*/
   CMpreset,   /* reset the port */

   /* Hub feature selectors */
@@ -128,6 +129,7 @@
   {CMclrhalt, "clrhalt",  1},
   {CMname,"name", 2},
   {CMtmout,   "timeout",  2},
+   {CMsampledelay, "sampledelay",  2},
   {CMpreset,  "reset",1},
 };

@@ -1387,6 +1389,11 @@
   ep->tmout = strtoul(cb->f[1], nil, 0);
   if(ep->tmout != 0 && ep->tmout < Xfertmout)
   ep->tmout = Xfertmout;
+   break;
+   case CMsampledelay:
+   if(ep->ttype != Tiso)
+   error("ctl ignored for this endpoint type");
+   ep->sampledelay = strtoul(cb->f[1], nil, 0);
   break;
   case CMpreset:
   deprint("usb epctl %s\n", cb->f[0]);
--- /n/downloads/usbxhci.c  Tue Feb 14 20:41:33 2023
+++ /sys/src/9/bcm/usbxhci.cTue Feb 14 11:24:53 2023
@@ -194,6 +194,7 @@

   int stopped;

+   int *residue;
   Wait*pending;
   Lock;
 };
@@ -277,6 +278,10 @@
   u32int  incr;
   u32int  tdsz;

+   /* isoread */
+   u32int  rp0;
+   u32int  frame0;
+
   int nleft;
 };

@@ -1100,10 +1105,17 @@
 {
   if(io->ring == nil)
   return;
-   io->frame = 0;
-   io->period = ep->pollival<<3*(ep->dev->speed == Fullspeed);
-   io->incr = (ep->hz*io->period<<8)/8000;
-   io->tdsz = (io->incr+255>>8)*ep->samplesz;
+   io->rp0 = io->ring->wp;
+   io->frame0 = io->frame = 0;
+   io->period = ep->pollival << 3*(ep->dev->speed == Fullspeed || 
ep->dev->speed == Lowspeed);
+   if(io->ring->id & 1){
+   io->ring->residue = 
smalloc((io->ring->mask+1)*sizeof(io->ring->residue[0]));
+   io->incr = 0;
+   io->tdsz = ep->maxpkt*ep->ntds;
+   } else {
+   io->incr = ((vlong)ep->hz*ep->pollival<<8)/1000;
+   io->tdsz = (io->incr+255>>8)*ep->samplesz;
+   }
   io->b = allocb((io->ring->mask+1)*io->tdsz);
 }

@@ -1336,10 +1348,10 @@
   }
   ?? = io->period;
   ctlr = ep->hp->aux;
-   if(needrecover(ctlr))
-   error(Erecover);
   for(i = io->frame;; i++){

Re: [9fans] cpu temp in drawterm

2023-02-14 Thread Jim Erickson
thank you moody! 'bind -a '#P' /dev' did the trick! i appreciate the
feedback. thanks to all for your time.

On Tue, Feb 14, 2023 at 4:13 PM  wrote:
>
> Resending this through the web interface because my email was dropped.
>
> Temperature stats are read from /dev/cputemp. How that file is served depends 
> on your system.
> On my machine the file is just in arch(3), other machines use acpi(8) to 
> serve this.
> You just need to ensure this file is in the namespace stats(1) is run within.
>
>
> For getting the temperature of the machine you are connecting to, either:
> % bind -a '#P' /dev # if your machine is like mine
> % aux/acpi # if your machine uses acpi
>
> You will likely have more success in just cracking open the code and reading 
> it then you will with google.
>
> moody
>
>
> 9fans / 9fans / see discussions + participants + delivery options Permalink

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc8476d0fe749cf6c-Mc4d14e19a0d57e11c6b4888c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] cpu temp in drawterm

2023-02-14 Thread moody
Resending this through the web interface because my email was dropped.

Temperature stats are read from /dev/cputemp. How that file is served depends 
on your system.
On my machine the file is just in arch(3), other machines use acpi(8) to serve 
this.
You just need to ensure this file is in the namespace stats(1) is run within.

For getting the temperature of the machine you are connecting to, either:
% bind -a '#P' /dev # if your machine is like mine
% aux/acpi # if your machine uses acpi
You will likely have more success in just cracking open the code and reading it 
then you will with google.
moody

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc8476d0fe749cf6c-Meb226150653c010c57b2a088
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] cpu temp in drawterm

2023-02-14 Thread David du Colombier
9legacy supports temperature reporting on x86, using /dev/cputemp.

-- 
David du Colombier

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc8476d0fe749cf6c-M2a3473706c2d1e85ad580680
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] cpu temp in drawterm

2023-02-14 Thread Skip Tavakkolian
I don't believe 9legacy '#c/sysstat' (/sys/src/9/port/devcons.c)
supports temperature reporting. If both drawterm's '#c/sysstat' and
Plan 9's '#c/sysstat' implement it, they would need to agree on the
format, because when using drawterm (as opposed to a real Plan 9
term), the commands run on the cpu but use the namespace exported by
drawterm.

On Tue, Feb 14, 2023 at 1:06 PM  wrote:
>
> what is the trick to getting the cpu temperature to read correctly in stats 
> in a drawterm session? i have googled quite a bit on this topic and can't 
> find anything helpful. thanks!
> 9fans / 9fans / see discussions + participants + delivery options Permalink

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc8476d0fe749cf6c-Meeed6f8c97015fa9abab97ac
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


[9fans] cpu temp in drawterm

2023-02-14 Thread jimerickso
what is the trick to getting the cpu temperature to read correctly in stats in 
a drawterm session? i have googled quite a bit on this topic and can't find 
anything helpful. thanks!
--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc8476d0fe749cf6c-M59b4b4eeec20c47e35736007
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] different users for different system roles

2023-02-14 Thread hiro
agreed. compartmentalization might be used to have less
users/passwords than servers. if two cpu servers are used
interchangably for the same usecase by the same end-users, why not
give them the same credentials.

next time please try to quote correctly, lyndon.

On 2/14/23, Lyndon Nerenberg (VE7TFX/VE6BBM)  wrote:
> hiro writes:
>> > should each system role get his own user?
>> > Like one user for file servers, one for auth, one for venti, and one for
>> cpu
>> > servers.
>
> My was has always been to have a file system user and an auth server
> user that are used ONLY for those roles.
>
> As for CPU servers, it really depends on how you use them.  The
> main reason you might want to have different CPU server owners is
> to control access to physical hardware.  E.g. I have machines that
> are used to control my radios via their serial and USB interfaces.
> For those, I don't want the "general pupulation" to have access to
> that hardware, so I run those servers under a userid that is distinct
> from the "general purpose" CPU server owner.
>
> Oh, the Pi I use for bluetooth dev work has its own host owner,
> for similar reasons.
>
> I'm sure there are other cases, but that's the only one where I've
> personally had a need for multiple host owners.
>
> --lyndon
>

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T690e4304847a34e4-M17036caa82debd1aa65af977
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription