Friday, December 21, 2012

Problem setting up HP LaserJet P1102 on Linux

If you have problem setting up driver for HP LaserJet P1102, it most probably because of Smart Install feature of the device. You can see it in dmesg output:


[353279.710023] usb 6-1: new high-speed USB device number 22 using ehci_hcd
[353279.824940] usb 6-1: New USB device found, idVendor=03f0, idProduct=002a
[353279.824944] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[353279.824947] usb 6-1: Product: HP LaserJet Professional P1102
[353279.824950] usb 6-1: Manufacturer: Hewlett-Packard
[353279.824952] usb 6-1: SerialNumber: 000000000Q84CF03SI1c
[353279.826253] scsi16 : usb-storage 6-1:1.0
[353280.838094] scsi 16:0:0:0: CD-ROM            HP       Smart Install    1.0  PQ: 0 ANSI: 2
[353280.868209] sr1: scsi3-mmc drive: 0x/0x caddy
[353280.868365] sr 16:0:0:0: Attached scsi CD-ROM sr1
[353280.868452] sr 16:0:0:0: Attached scsi generic sg2 type 5

it is useful for Windows users as it will create a virtual cdrom drive in order to install the printer's driver. For Linux, this feature will prevent the setup utility to detect it as a USB printer as it sees it as a disk. The solution to this problem is by deactivating the feature using usb_modeswitch utility as below:


usb_modeswitch -m 4 -r 4 -v 0x03f0 -p 0x002a -M 55534243287E778400000000000006D0000000000000000000000000000000 -n

Please login as root before issuing the command.

The output is something like this:


Looking for default devices ...
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Accessing device 023 on bus 006 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x04 (out) and 0x04 (in)
Not a storage device, skipping SCSI inquiry

USB description data (for identification)
-------------------------
Manufacturer: Hewlett-Packard
     Product: HP LaserJet Professional P1102
  Serial No.: 000000000Q84CF03SI1c
-------------------------
Looking for active driver ...
 No driver found. Either detached before or never attached
Setting up communication with interface 0
Using endpoint 0x04 for message sending ...
Trying to send message 1 to endpoint 0x04 ...
 Sending the message returned error -5. Trying to continue
Reading the response to message 1 (CSW) ...
 Response reading got error -5
 Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.

(This output is after I ran the command once. You may see something like removing/deactivating the disk.) 

Then restart the printer or turn it off and on again. You should now run hp-setup utility to setup the printer and this time it can see the attached USB printer listed and you can select the printer to install the driver.

Hope this helps. Have fun!

Update: Whenever you restart your pc,  it can't connect to the printer. So this is not permanent solution. What you have to do is run the command of usb_modeswitch again and there you go. It will recognize the printer but this time you dont have to reinstall the driver. For permanent solution, from what I have read, I need to use Windows to run the printer's utility software but I never tried it before. if I have tried it, i will post it here.

Sunday, December 9, 2012

Postfix: smtp_address_preference

For mailserver/system  administrator :

If your mailserver has problem to connect to ipv6 address (especially if your mailserver doesn't support it) and throw errors something like this:

Dec 10 00:05:57 localhost postfix/smtp[16925]: connect to mta7.am0.yahoodns.net[2404:160:0:f:0:2:42c4:7621]:25: Network is unreachable
Dec 10 00:05:57 localhost postfix/smtp[16925]: connect to mta6.am0.yahoodns.net[2404:160:0:f:0:1:6288:d9ca]:25: Network is unreachable
Dec 10 00:05:57 localhost postfix/smtp[16925]: connect to mta7.am0.yahoodns.net[2404:160:0:f:0:2:42c4:7624]:25: Network is unreachable
Dec 10 00:05:57 localhost postfix/smtp[16925]: connect to mta6.am0.yahoodns.net[2404:160:0:f:0:1:43c3:a8e6]:25: Network is unreachable
Dec 10 00:05:57 localhost postfix/smtp[16925]: connect to mta6.am0.yahoodns.net[2404:160:0:f:0:1:42c4:7622]:25: Network is unreachable

then you may want to check the default smtp_address_preference parameter in main.cf. Most probably it is defaulted to ipv6 which is true on my postfix installation (Mageia). Change it to ipv4 to instruct postfix to look up MTA with ipv4 address only (which is I think supported by all major players like Yahoo!, Gmail and Hotmail for compatibility reason or they will lose lots of their customers) . So:

smtp_address_preference = ipv4

will save you before you consider to upgrade your infrastructure to ipv6. :-)

Have fun!

Second monitor no display after latest update - KDE-neon

 After latest update as of Oct 3, 2023, my second monitor was undetected with latest kernel (6.2.0-33-generic). If I boot with previous kern...