Skip to content

Commit 8a99e6d

Browse files
committed
Reorganized and simplified repository
Signed-off-by: Elsie Hupp <[email protected]>
1 parent ba28ea5 commit 8a99e6d

File tree

150 files changed

+5529
-1678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+5529
-1678
lines changed

README.md

+63-22
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,74 @@
1-
> ## Note
2-
>
3-
> This repository aggregates the source code components available at [ellert.se/twain-sane](http://www.ellert.se/twain-sane/) for the purpose of setting up a Git workspace for the project of getting the TWAIN SANE Interface running in 64-bit for current versions of macOS.
4-
>
5-
> ***The contents of this repository do not currently compile.***
6-
>
7-
> I do not anticipate making progress on this project myself in the foreseeable future, as, among other things, I have very little experience with Cocoa and Objective-C, and learning macOS development is not a current focus for me.
8-
>
9-
> Please feel free to fork this repository as a base for working on it yourself, and please do tag me if you make any progress!
10-
>
11-
> — Elsie Hupp ([@elsiehupp](https://github.com/elsiehupp)) September 2021
1+
# TWAIN-SANE Interface for macOS
122

13-
---
3+
## Introduction
144

15-
(Text below lightly adapted from [ellert.se/twain-sane](http://www.ellert.se/twain-sane/).)
5+
This repository aggregates the source code components available at [ellert.se/twain-sane](http://www.ellert.se/twain-sane/) for the purpose of setting up a Git workspace for the project of getting the TWAIN SANE Interface running in 64-bit for current versions of macOS.
166

17-
# TWAIN SANE Interface for MacOS X
7+
***The contents of this repository do not currently compile.***
188

19-
This is a TWAIN datasource for MacOS X that aquires images using the SANE backend libraries. The SANE backend libraries provide access to a large range of scanners connected through SCSI or USB. For a complete list see the documentation on [the SANE project homepage](http://www.sane-project.org/). It works with my HP SCSI scanner, and many people have reported success with a large number of different scanners. The feedback from users have helped the SANE developers to fix problems with various backends, so with each release of the SANE backends more of the MacOS X specific problems have been solved.
9+
I do not anticipate making progress on this project myself in the foreseeable future, as, among other things, I have very little experience with Cocoa and Objective-C, and learning macOS development is not a current focus for me.
2010

21-
The TWAIN SANE interface is not a standalone application. It is designed to be used from within other applications. It works with applications supporting the TWAIN specification, which includes most applications on Mac OS X that handles images. However using it with Apple‘s Image Capture application has become increasingly tricky with every version of Mac OS X. You will have an easier experience if you choose any other application.
11+
Please feel free to fork this repository as a base for working on it yourself, and please do tag me if you make any progress!
2212

23-
The TWAIN SANE Interface is provided as a binary package and as source code. To use the interface you only have to install the binary package. Before installing the TWAIN SANE Interface package you should install the libusb and the sane-backends binary packages.
13+
— Elsie Hupp ([@elsiehupp](https://github.com/elsiehupp)) September 2021
2414

25-
There is also a optional SANE Preference Pane package available, which makes it easier to configure the sane-backends drivers. If you don’t install this package you can still configure the sane-backends using a text editor in the Terminal.
15+
## Repository Contents
2616

27-
If you want to compile the sources you also have to install the gettext package. If you are cross-compiling using the MacOS X cross-compilation SDKs you need to install the corresponding SDKs for the used packages.
17+
This repository includes three subdirectories:
2818

29-
The **latest version is 3.6**.
19+
### `TwainSaneInterface`
3020

31-
## Localizations
21+
This package is the core of Mattias Ellert's project. It maps SANE's API to a TWAIN API and provides a graphical user interface for use within Apple Image Capture and macOS applications that use Image Capture as a scanner or camera interface. (This package does not compile and has not been adapted to Homebrew-installed `sane-backends`.)
3222

33-
The TWAIN SANE Interface has been localized to the following languages: English, French, German, Italian, Japanese, Russian and Swedish. For most of the translation it relies on the localization support in the SANE backend libraries.
23+
> The contents of `TwainSaneInterface` are licensed under the GPLv2.
24+
25+
### `SanePreferencePane`
26+
27+
This optional [Preference Pane](https://developer.apple.com/documentation/preferencepanes) package form Mattias Ellert's project makes it easier to configure the `sane-backends` drivers. If you don’t install this package you can still configure the `sane-backends` using a text editor in the Terminal. (This package does not compile and has not been adapted to Homebrew-installed `sane-backends`. Oddly, the compiled version of this did run correctly under macOS 11, even though the compiled `TwainSaneInterface` did not. I think this may just be due to how Preference Panes work.)
28+
29+
> The contents of `SanePreferencePane` are licensed under the GPLv2.
30+
31+
### `VirtualScanner`
32+
33+
This is a sample project [from Apple's Developer documentation archive](https://developer.apple.com/library/archive/samplecode/VirtualScanner/Introduction/Intro.html). I have included it because does not seem to depend on `Carbon.framework`, though it still does not compile (albeit for different reasons.).
34+
35+
> The contents of `VirtualScanner` are licensed under Apple's version of the MIT License.
36+
37+
## External Requirements
38+
39+
After doing some further digging, I have simplified the contents of this repository to exclude the dependencies available through [Homebrew](https://brew.sh/). Rather than including an ancient version of the source code for `sane-backends`, I would encourage you to install the fully maintained Homebrew version using the following Terminal commands:
40+
41+
### 1. Install Homebrew (if you haven't already):
42+
43+
```bash
44+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
45+
```
46+
47+
### 2. Install `sane-backends`:
48+
49+
```bash
50+
brew install sane-backends
51+
```
52+
53+
The advantage with this approach is that the version you have installed will be completely up-to-date. I have not updated any of the code to dynamically linking to the Homebrew version, though, because I'm not sure exactly what would be involved.
54+
55+
## Problem Statement
56+
57+
Mattias Ellert's original code no longer compiles on current versions of macOS due to two prerequisite Apple libraries never making the jump to 64-bit:
58+
59+
1. [`Carbon.framework`](https://en.wikipedia.org/wiki/Carbon_(API)) (Yes, we knew this fourteen years ago.)
60+
2. `ICADevices.framework` (Depends on `Carbon.framework`)
61+
62+
Additionally, `TWAIN.framework` doesn't appear in Apple's current Developer documentation, but I checked on my Mac (running macOS 12.1), and `/System/Library/Frameworks/TWAIN.framework` is still there, so seemingly it's still current.
63+
64+
Regardless, Apple no longer provides any current references for creating scanner drivers in particular. As best I can tell, approaches that might work for modernizing the TWAIN-SANE Interface are as follows:
65+
66+
* At the very least, port the existing `TwainSaneInterface` (and maybe `SanePreferencePane`) code to access `sane-backends` dynamically, and port it from `Carbon.framework` to `Cocoa.framework` (or even SwiftUI).
67+
* Maybe create a wrapper for `sane-backends` using [`DriverKit`](https://developer.apple.com/documentation/driverkit), specifically [`USBDriverKit`](https://developer.apple.com/documentation/usbdriverkit) (though this would rule out `sane-backends` using parallel, SCSI, or any other non-USB interface)?
68+
* Maybe port the `TwainSaneInterface` from using `TWAIN.framework` to using `ImageCaptureCore` directly? (It's unclear to me whether `ImageCaptureCore` is only for client applicaitons or if it's for drivers, as well.)
69+
70+
Note that `TwainSaneInterface` is written entirely in C and C++, not Objective-C. The only Objective-C file in the entire project is in `TwainSaneInterface` (though the `VirtualScanner` sample project is written in Objective-C). TWAIN is (as far as I can tell) basically a set of C headers, so any code accessing them would need to accept these. In order to access both TWAIN and Cocoa in the same project, it may be necessary to use [Objective-C++](https://objectivecpp.johnholdsworth.com/intro.html), which is just its own weird, weird beast.
71+
72+
Anyway, I hope this updated commentary is helpful!
73+
74+
— Elsie Hupp ([@elsiehupp](https://github.com/elsiehupp)) January 2022

LICENSE SanePreferencePane/LICENSE

File renamed without changes.

SanePreferencePane/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(Text below lightly adapted from [ellert.se/twain-sane](http://www.ellert.se/twain-sane/).)
2+
3+
# TWAIN SANE Interface for MacOS X
4+
5+
This is a TWAIN datasource for MacOS X that aquires images using the SANE backend libraries. The SANE backend libraries provide access to a large range of scanners connected through SCSI or USB. For a complete list see the documentation on [the SANE project homepage](http://www.sane-project.org/). It works with my HP SCSI scanner, and many people have reported success with a large number of different scanners. The feedback from users have helped the SANE developers to fix problems with various backends, so with each release of the SANE backends more of the MacOS X specific problems have been solved.
6+
7+
The TWAIN SANE interface is not a standalone application. It is designed to be used from within other applications. It works with applications supporting the TWAIN specification, which includes most applications on Mac OS X that handles images. However using it with Apple‘s Image Capture application has become increasingly tricky with every version of Mac OS X. You will have an easier experience if you choose any other application.
8+
9+
The TWAIN SANE Interface is provided as a binary package and as source code. To use the interface you only have to install the binary package. Before installing the TWAIN SANE Interface package you should install the libusb and the sane-backends binary packages.
10+
11+
There is also an optional SANE Preference Pane package available, which makes it easier to configure the sane-backends drivers. If you don’t install this package you can still configure the sane-backends using a text editor in the Terminal.
12+
13+
If you want to compile the sources you also have to install the gettext package. If you are cross-compiling using the MacOS X cross-compilation SDKs you need to install the corresponding SDKs for the used packages.
14+
15+
The **latest version is 3.6**.
16+
17+
## Localizations
18+
19+
The TWAIN SANE Interface has been localized to the following languages: English, French, German, Italian, Japanese, Russian and Swedish. For most of the translation it relies on the localization support in the SANE backend libraries.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)