Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Handhelds

Journal the_mad_poster's Journal: [??wahfuh?] ATTENTION: COMPUTER ENGINEERS 10

I have a question.

I have a Palm. It has a 256MB SD Card in it. I want it to be able to act like removable storage under Windows, and, although it works quite well, I don't want to buy commercial software to do it.

No, I don't want a thumb drive. I have enough crap on my keychain, including four keys for various things at work. I don't need anything else on it.

Even if that means I have to write my own bloody app for my Palm.

I understand the concepts involved in writing applications for Palms, and I'm guessing that figuring out how to interact with the USB device on the Palm will come with understanding PalmOS better. The problem I have in beginning my little project here is that I cannot, for the bloody life of me, figure out how to write a driver for a non-Windows platform that can interact with Windows. I understand that Windows XP has usbstor.sys which will theoretically allow me to use some sort of API to transfer files around.

But how the hell do I use it? Assuming I can figure out how to get through the enumeration process and I get Windows to understand that I just plugged in a mass storage device to the USB port and it loads usbstor.sys, what then? How does the communication work between my app on the Palm and Windows? I would assume I'm going to need to both send and receive commands that open/close, delete/create, and rename files since I'll need to do translations to make sure everything stays kosher. But how?

I'm totally lost. So far I figured out:

1) How USB enumeration works
2) How to write apps for PalmOS
3) How to do this on Linux with the USB kernel drivers.

But hell if I can do it with Windows. Lots of documentation telling me how to write a windows app that will interface with a USB device, can't find squat about how to write an app for a USB device that will understand Windows calls coming into the thing.

Of course, I'm probably just not understanding something about how Windows or USB communication in general works. Whatever the case, I'd very much appreciate if someone could point me in the right direction. And, of course, anything (useful) I manage to get developed will be GPL'ed.

This discussion was created by the_mad_poster (640772) for no Foes, but now has been archived. No new comments can be posted.

[??wahfuh?] ATTENTION: COMPUTER ENGINEERS

Comments Filter:
  • Comment removed based on user account deletion
    • So if I understand this, usbstor.sys is just going to get loaded after the enumeration is complete and I've identified myself as a USB MSC. Then, I'll communicate with the host using the usb msc standard, which means I won't have to dick around with any sort of Windows API at all.

      Right?
      • Comment removed based on user account deletion
        • Not quite sure what you mean. The SD card is formatted as vFAT and the palm will be a simple slave device. It will never actively seek to read anything from the actual disks (e.g. - it will send files to the host at the host's request and it will get files from the host at the host's request). Basically, while it's acting as a virtual drive, the Palm won't be able to do anything else at all, including exiting the application, save for a few limited functions like critical system warnings (e.g. low battery).
          • Comment removed based on user account deletion
            • Bingo [palmos.com]

              Step 1:
                  Open Port
              Step 2:
                  Establish connection through enumeration
              Step 3:
                  Run a psuedo-driver for MSC until the user requests the connection be closed

              In theory, I now know what I'm doing, though this is shaping up to be a rather hefty process between all the demands of Palm programming and USB standards.
  • ...or may not be what you're looking for. It sounds to me like you want your Palm with memory card to act as a USB device, not a USB host. So... you want it to be something like the USB Gadget Serial Driver that is in the Linux kernel source for embedded Linux USB devices:

    http://www.ibiblio.org/peanut/Kernel-2.6.12.2/usb/ gadget_serial.txt [ibiblio.org]

    This link and the actual kernel source for that driver might give you some idea of how to use your Palm as a USB device. Or I could have totally isread you, which I

    • Basically, I'm going to write a PalmOS 3.x application that emulates the behavior of a thumb drive. When it's launched, Windows will identify the USB connection and begin querying it, the device will send the appropriate identification for a USB MSC device, and then, in theory, I will be able to treat the memory card on the Palm as a removable drive within Windows, thus making it possible to transfer files to and from the Palm's card using Windows Explorer.

      What's throwing me off is that I'm thinking I'm goi
      • What's throwing me off is that I'm thinking I'm going to have to use some sort of Windows API at some point, but squiggleslash's links suggest otherwise.

        Squiggleslash is right. If it helps you to think about it as a client / server paradigm, the Palm in this case is going to be ther server. As long as the server properly implements the USB protocol, you won't have to mess with any Win32 at all. All of your coding will be done on the Palm, then any OS (Win, Linux, OS X) that supports USB will be able to us

The rule on staying alive as a program manager is to give 'em a number or give 'em a date, but never give 'em both at once.

Working...