Back to Knowledege base

Understanding Printer States and State Transitions

How to monitor and control printer states in Xi-Text

The Eight Printer States

Every Xi-Text printer is always in one of eight states:

Startup : Printer initialising with setup string after start command

Idle : Ready to print jobs with current form type

Printing : Actively printing a job

Shutdown : Processing shutdown sequence after halt command

Halted : Stopped, no jobs printing (initial state after installation)

a/w oper : Awaiting operator - alignment approval or single-job mode confirmation

Offline : Detected as offline (hardware issue)

Error : Unrecoverable error (configuration or communication issue)

State Transitions

Normal printing cycle:

Halted → Startup → Idle → Printing → Idle → ... → Shutdown → Halted

With alignment:

Halted → Startup → Printing (alignment) → a/w oper → Idle → Printing → ...

Error conditions:

Any state → Error (configuration problem)
Any state → Offline (hardware problem)

Viewing Printer States

bash

# List all printers with states
splist

# Sample output:
# ptr1  <lp0>     a4.ps  idle
# ptr2  <srv:910> letter printing  15033 jsmith
# ptr3  <lp1>     a4     halted
# ptr4  <lp2>     labels offline

In spq (visual interface):

bash

spq -P  # Start in printer view

# State shown in state column
# Additional messages may appear on right

Startup State

When entered:

  • Operator gives start command (G in spq, or spstart ptr1)

What happens:

  1. Xi-Text reads setup file for current form type
  2. Sends setup string to printer
  3. If alignment file configured, prints alignment page
  4. Transitions to Idle (or a/w oper if alignment needed)

Duration:

  • Usually very brief (seconds)
  • May be longer if complex setup string
  • Visible on lightly loaded systems

Commands available:

None - state is transient

Idle State

When entered:

  • After successful startup
  • After completing a print job
  • After operator approves alignment

What it means:

Printer ready to accept jobs with matching form type.

Commands available:

bash

# Halt printer
sphalt ptr1  # Halt at end of current job (none running)
# OR in spq: 'h' or 'H'

# Change form type
sqchange -f letter ptr1

# Delete printer
spdel ptr1
# OR in spq: 'D'

Normal operation:

Printer remains Idle until job available, then transitions to Printing.

Printing State

When entered:

  • Job selected for printing
  • Printer begins sending job data

What happens:

  • Job number and owner shown with state
  • Progress indicated (page number if pages detectable)
  • Job data sent through any configured filters
  • Suffix-specific strings sent as needed

Commands available:

bash

# Interrupt printing (halt at end of job)
# In spq: 'h'

# Abort printing immediately
# In spq: 'H'

# Interrupt and restart (rush job through)
# In spq: '!'

Duration:

Depends on job size and printer speed.

Shutdown State

When entered:

  • Operator halts printer
  • Printer finishing current job (if any)
  • Sending shutdown strings

What happens:

  1. Current job completes (if using 'h' command)
  2. docend string sent
  3. sufend string sent if needed
  4. halt string sent
  5. Transitions to Halted

Duration:

Usually brief, but may take time if:

  • Large docend, sufend, or halt strings
  • Printer buffer full
  • Printer offline (may timeout)

Forcing shutdown:

bash

# In spq, press 'H' again
# Kills filter process
# Immediate transition to Halted

Indication in spq:

Line marked with AB!! (abort) or (heoj) (halt at end of job).

Halted State

When entered:

  • Initial state after printer added
  • After shutdown sequence completes
  • Operator halt command

What it means:

No jobs will print on this printer.

Commands available:

bash

# Start printer
spstart ptr1
# OR in spq: 'G'

# Change form type
sqchange -f letter ptr1
# OR in spq: 'f'

# Change device
sqchange -d /dev/lp1 ptr1  
# OR in spq: 'V'

# Delete printer
spdel ptr1
# OR in spq: 'D'

Normal use:

Halt printer to:

  • Change paper (and form type)
  • Perform maintenance
  • Troubleshoot issues
  • Prevent printing temporarily

a/w oper (Awaiting Operator) State

When entered:

  • After printing alignment page (awaiting approval)
  • Single-job mode (awaiting confirmation between jobs)

What happens:

Printer waits for operator to:

  • Approve alignment (y command)
  • Reject alignment (n command)

Indication:

N/A marker shown if alignment not approved.

Commands:

bash

# Approve alignment
spok ptr1
# OR in spq: 'y'

# Reject alignment (print again)
spnok ptr1
# OR in spq: 'n'

# Halt printer
sphalt ptr1
# OR in spq: 'h' or 'H'

After approval:

Printer transitions to Idle or Printing (if jobs waiting).

After rejection:

Alignment page prints again, returns to a/w oper.

Offline State

When entered:

  • Printer hardware detected as offline
  • Network printer unreachable
  • Serial port signals indicate offline

What it means:

Hardware or connectivity issue preventing printing.

Indication:

Message may show cause:

ptr1  <lp0>  a4  offline:Out of paper
ptr2  <srv>  a4  offline

Recovery:

  1. Fix hardware issue (add paper, clear jam, power on)
  2. Verify connectivity (check cables, network)
  3. Start printer:

bash

spstart ptr1

See "Printer Shows Offline" article for detailed troubleshooting.

Error State

When entered:

  • Configuration error in setup files
  • Device inaccessible
  • Filter command fails
  • I/O error

What it means:

Software or configuration problem requires fixing.

Indication:

Message may show cause:

ptr1  <lp0>  a4  error:Parse error in setup file
ptr2  <srv>  a4  error

Diagnosis:

bash

# View system log
tail /var/spool/spd/spshed_reps

# OR in spq: 'X'

Recovery:

  1. Fix underlying problem (edit setup file, fix permissions, etc.)
  2. Halt printer:

bash

sphalt ptr1
  1. Start printer:

bash

spstart ptr1

See "Printer Enters Error State" article for detailed troubleshooting.

State Transition Commands

Start Printer (G)

From: Halted To: Startup → Idle (or a/w oper)

bash

spstart ptr1
# OR in spq: 'G'

Halt at End of Job (h)

From: Idle or Printing To: Shutdown → Halted

bash

# Command line
sphalt ptr1

# In spq: 'h'

If printing, waits for job to complete.

Halt Immediately (H)

From: Any state except Halted To: Shutdown → Halted (or directly to Halted)

bash

# In spq: 'H'

Aborts current job if printing.

Approve Alignment (y)

From: a/w oper To: Idle or Printing

bash

spok ptr1
# OR in spq: 'y'

Reject Alignment (n)

From: a/w oper To: a/w oper (after printing alignment again)

bash

spnok ptr1
# OR in spq: 'n'

Interrupt and Restart (!)

From: Printing To: Halted, then immediately Startup → Printing

bash

# In spq only: '!'

Equivalent to: H (halt immediately), then G (start).

Useful for rush jobs - interrupts current job, prints rush job, returns to interrupted job.

Monitoring Printer States

Watch printers in real-time:

bash

watch -n 2 splist

Check specific printer:

bash

spstat ptr1 idle && echo "Printer ready"

Script example - wait for idle:

bash

#!/bin/bash
# wait-for-idle.sh

PRINTER=$1

while ! spstat $PRINTER idle; do
    echo "Waiting for $PRINTER to become idle..."
    sleep 5
done

echo "$PRINTER is now idle"

State-Based Operations

Change Form Type (requires Halted)

bash

# Check state
splist ptr1

# If not halted, halt it
if ! spstat ptr1 halted; then
    sphalt ptr1
    # Wait for halted state
    while ! spstat ptr1 halted; do
        sleep 1
    done
fi

# Change form type
sqchange -f letter ptr1

# Start with new form type
spstart ptr1

Safe Printer Deletion

bash

# Halt printer if running
sphalt ptr1

# Wait for halted
while ! spstat ptr1 halted; do
    sleep 1
done

# Delete printer
spdel ptr1

Best Practices

Start printers at system boot:

Ensures printers available for jobs.

Halt before maintenance:

Always halt printer before performing physical maintenance.

Monitor state transitions:

Watch for printers getting stuck in Startup or Shutdown - indicates problems.

Use appropriate halt command:

  • Use h (halt at end of job) in normal operation
  • Use H (halt immediately) only when necessary

Check state before operations:

Many operations require specific states (Halted for form type change, etc.).

Document state changes:

Log when/why printers halted for extended periods.

Understanding Form Types, Paper Types, and Suffixes
How Xi-Text uses form types to manage different paper and printing requirements