Linux slogan
Visite também: Segurança Linux · BR-Linux.org · Dicas-L · Doode · NoticiasLinux · SoftwareLivre.org · UnderLinux



» Screenshot
Linux: Debian Wheezy com G3 - Gnome-Shell
Por walescko
» Login
Login:
Senha:

Se você ainda não possui uma conta, clique aqui.

Esqueci minha senha


Comunidades

Comunidade Linux Home Participar da comunidade Linux Participar Fórum Linux Fórum Membros LinuxMembros RSS do fórum

<< Primeira | Anterior Próxima | Última >>

Desenvolvendo um driver para CUPS

[1] Enviado em 09/02/2012 - 18:51h Desenvolvendo um driver para CUPS
Linux user: Yuri Albuquerque
Denommus

(usa Fedora)


Desenvolvi um driver para CUPS (com um arquivo .drv, devidamente compilado num .ppd e um filtro em C, devidamente compilado num binário), porém o Linux não reconhece a impressora como uma impressora. Ela não aparece na lista de impressoras a serem adicionadas nem nada disso.

O Linux reconhece a impressora como um dispositivo USB conectado, então desconfio que meu PPD esteja pegando o nome do modelo errado (a impressora é um protótipo, não existe em nível industrial, ainda).

Existe alguma forma de descobrir o modelo da impressora através da linha de comando? O manual da mesma não é muito claro sobre isso.

Existe a possibilidade de ser outra coisa atrapalhando o reconhecimento do driver?

 

  


[2] Enviado em 09/02/2012 - 18:58h Re: Desenvolvendo um driver para CUPS
Linux user: Joao
stack_of

(usa Slackware)


Observe a saída do comando `lsusb -v`, tenho uma multifuncional HP C4680:

Bus 001 Device 003: ID 03f0:7411 Hewlett-Packard
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x03f0 Hewlett-Packard
  idProduct          0x7411
  bcdDevice            1.00
  iManufacturer           1 HP
  iProduct                2 Photosmart C4600 series
  iSerial                 3 BR05BG3TBW05G0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          124
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    204
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x08  EP 8 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x89  EP 9 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    212
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0


 

[3] Enviado em 09/02/2012 - 19:09h Re: Desenvolvendo um driver para CUPS
Linux user: Joao
stack_of

(usa Slackware)


 

[4] Enviado em 09/02/2012 - 19:20h Resultados
Linux user: Yuri Albuquerque
Denommus

(usa Fedora)


Esse foi o resultado. Substituí o nome da companhia e do modelo da impressora porque são modelos novos e não posso divulgar.

Reparei que o meu resultado foi diferente do seu. Meu idProduct foi preenchido, mas iProduct está vazio. Quais das informações devo colocar no PPD do CUPS?

Bus 001 Device 009: ID 0404:0312 **** Corp. ***** Printer Receipt
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0         8
  idVendor           0x0404 **** Corp.
  idProduct          0x0312 ***** Printer Receipt
  bcdDevice           35.29
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              7
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1


 

[5] Enviado em 09/02/2012 - 20:05h Re: Desenvolvendo um driver para CUPS
Linux user: Joao
stack_of

(usa Slackware)


Couldn't open device, some information will be missing


Executou o comando como root?



 

[6] Enviado em 09/02/2012 - 20:22h Re: Desenvolvendo um driver para CUPS
Linux user: Yuri Albuquerque
Denommus

(usa Fedora)


Não mudou tanto assim:
Bus 001 Device 009: ID 0404:0312 NCR Corp. 7197 Printer Receipt
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0         8
  idVendor           0x0404 NCR Corp.
  idProduct          0x0312 7197 Printer Receipt
  bcdDevice           35.29
  iManufacturer           1 NCR
  iProduct                2 7198 EPiC
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              7 EPic
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1


Começo a duvidar que o problema seja esse. Talvez seja o ModelNumber que esteja errado. Um tanto complicado saber como o CUPS associa um determinado driver com a impressora.

 

[7] Enviado em 09/02/2012 - 21:41h Re: Desenvolvendo um driver para CUPS
Linux user: Joao
stack_of

(usa Slackware)


Tenta assim:

udevadm info --query=path --attribute-walk --name=/dev/usbdev1.9


 

[8] Enviado em 09/02/2012 - 21:47h Re: Desenvolvendo um driver para CUPS
Linux user: Joao
stack_of

(usa Slackware)


O udev deve ter um banco de dados de dispositivos. Talvez pelo fato da novidade do dispositivo, o nome não conste no banco de dados.
Observei no path do dispositivo, vários nodos com informações do produto, vendedor etc...
Observe o diretório no path do dispositivo informado pelo comando que informei:

/sys/devices/pci0000:00/0000:00:12.2

 

[9] Enviado em 10/02/2012 - 11:00h Re: Desenvolvendo um driver para CUPS
Linux user: Yuri Albuquerque
Denommus

(usa Fedora)


Desculpe pela perda de tempo, mas o problema era diverso ao que eu imaginava. A documentação do CUPS é bem dispersa e confusa, então eu imaginava que o CUPS detectava a impressora usando um arquivo PPD, quando na verdade ele usa backends.

De qualquer forma, aprender todos esses comandos foi útil para desenvolver o backend. Obrigado.

 

  
<< Primeira | Anterior Próxima | Última >>
Responsável pelo site: Fábio Berbert de Paula - Conteúdo distribuído sob licença GNU FDL
Site hospedado por:

Viva o Linux

A maior comunidade Linux da América Latina! Artigos, dicas, tutoriais, fórum, scripts e muito mais. Ideal para quem busca auto-ajuda em Linux.