This project is read-only.

Wrong DeviceType


When trying out the WIA.NET package I am unable to acquire an image from my scanner because the package is recognizing it as a camera. Browsing through the source I see that the value for DeviceType.Scanner is set to 65537.
That is not the correct value for a scanner (at least not for my scanner, which is an HP OfficeJet 6500). Reading the properties from my scanner I see that the DeviceInfo.Property["Type"].get_Value() is actually set as 65538.

file attachments


korthmat wrote Aug 6, 2013 at 8:49 PM

I just encountered this one myself.

From what I was able to tell, the type returned by the Type property is a multiplexed value, containing a 16-bit type and 16-bit subtype combined into a single DWORD. The type is in the high-order WORD. So the solution would be to not set DeviceTypes.Scanner to 65537--just let it take its default value--and change the code in the WiaDevice constructor setting Type to this:
this.Type = (DeviceTypes)((int)(device.Properties.GetProperty(5)) >> 16);
References include WIA Device Type Specifiers, and this comment in the C++ header file sti.h:
// Type of device ( scanner, camera) is represented by DWORD value with
// hi word containing generic device type , and lo word containing sub-type
I've attached a patch.