diff options
Diffstat (limited to 'sys/pccard')
-rw-r--r-- | sys/pccard/cardinfo.h | 2 | ||||
-rw-r--r-- | sys/pccard/pccard.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/pccard/cardinfo.h b/sys/pccard/cardinfo.h index 06c6f4d..f71cd6f 100644 --- a/sys/pccard/cardinfo.h +++ b/sys/pccard/cardinfo.h @@ -58,7 +58,7 @@ /* * Slot states for PIOCGSTATE */ -enum cardstate { noslot, empty, suspend, filled }; +enum cardstate { noslot, empty, suspend, filled, inactive }; /* * Descriptor structure for memory map. diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 298fbb5..97c2294 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -318,7 +318,7 @@ pccard_event(struct slot *slt, enum card_event event) * The slot and devices are disabled, but the * data structures are not unlinked. */ - if (slt->state == filled) { + if (slt->state == filled || slt->state == inactive) { slt->state = empty; disable_slot_to(slt); } @@ -600,11 +600,13 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p) if (!pwval) { if (slt->state != filled) return EINVAL; + pccard_event(slt, card_removed); + slt->state = inactive; } else { - if (slt->state != empty) + if (slt->state != empty && slt->state != inactive) return EINVAL; + pccard_event(slt, card_inserted); } - pccard_event(slt, pwval == 0 ? card_removed : card_inserted); break; case PIOCSBEEP: if (pccard_beep_select(*(int *)data)) { |