version 1.74, 2020/06/28 05:17:25 |
version 1.75, 2020/06/28 05:21:39 |
|
|
void dev_done(struct dev *); |
void dev_done(struct dev *); |
struct dev *dev_bynum(int); |
struct dev *dev_bynum(int); |
void dev_del(struct dev *); |
void dev_del(struct dev *); |
|
void dev_setalt(struct dev *, unsigned int); |
unsigned int dev_roundof(struct dev *, unsigned int); |
unsigned int dev_roundof(struct dev *, unsigned int); |
void dev_wakeup(struct dev *); |
void dev_wakeup(struct dev *); |
void dev_sync_attach(struct dev *); |
void dev_sync_attach(struct dev *); |
|
|
} |
} |
|
|
/* |
/* |
|
* set prefered alt device name |
|
*/ |
|
void |
|
dev_setalt(struct dev *d, unsigned int idx) |
|
{ |
|
struct dev_alt **pa, *a; |
|
|
|
/* find alt with given index */ |
|
for (pa = &d->alt_list; (a = *pa)->idx != idx; pa = &a->next) |
|
; |
|
|
|
/* detach from list */ |
|
*pa = a->next; |
|
|
|
/* attach at head */ |
|
a->next = d->alt_list; |
|
d->alt_list = a; |
|
|
|
/* reopen device with the new alt */ |
|
if (idx != d->alt_num) |
|
dev_reopen(d); |
|
} |
|
|
|
/* |
* adjust device parameters and mode |
* adjust device parameters and mode |
*/ |
*/ |
void |
void |
|
|
{ |
{ |
int i; |
int i; |
char name[CTL_NAMEMAX]; |
char name[CTL_NAMEMAX]; |
|
struct dev_alt *a; |
|
|
d->master_enabled = 0; |
d->master_enabled = 0; |
d->mode = d->reqmode; |
d->mode = d->reqmode; |
|
|
NULL, -1, 127, d->slot[i].vol); |
NULL, -1, 127, d->slot[i].vol); |
} |
} |
|
|
|
for (a = d->alt_list; a != NULL; a = a->next) { |
|
snprintf(name, sizeof(name), "%d", a->idx); |
|
dev_addctl(d, "", CTL_SEL, |
|
CTLADDR_ALT_SEL + a->idx, |
|
"server", -1, "device", |
|
name, -1, 1, a->idx == d->alt_num); |
|
} |
|
|
d->pstate = DEV_INIT; |
d->pstate = DEV_INIT; |
return 1; |
return 1; |
} |
} |
|
|
c->dirty = 1; |
c->dirty = 1; |
dev_ref(d); |
dev_ref(d); |
} else { |
} else { |
if (addr == CTLADDR_MASTER) { |
if (addr >= CTLADDR_ALT_SEL) { |
|
if (val) { |
|
num = addr - CTLADDR_ALT_SEL; |
|
dev_setalt(d, num); |
|
} |
|
return 1; |
|
} else if (addr == CTLADDR_MASTER) { |
if (d->master_enabled) { |
if (d->master_enabled) { |
dev_master(d, val); |
dev_master(d, val); |
dev_midi_master(d); |
dev_midi_master(d); |