erjiang / usbscale

Reads weight data from USB scales.
GNU General Public License v3.0
90 stars 22 forks source link

usbscales issues with Satorious Practium313-1S #16

Closed seacuello closed 1 year ago

seacuello commented 7 years ago

Hello All -

I'm working with this particular scale: Satorious Practium 313-1S

I connect the scale to a raspberry pi and ran lsusb to find that it is connected and to gather the IDvendor and IDProduct values: 0x24bc & 0x0011

I then added this values to both the scales.h and rules file. I also enabled the debugging line in the make file.

I was able to make usbscales and execute it, but receive the error 'Error is USB Transport'

here is the result of running sudo ./usbscale :

pi@raspberrypi:~/Downloads/usbscale $ sudo ./usbscale Found scale 24bc:0011 (bus 1, device 6) It has descriptors: manufc: 1 prodct: 2 serial: 3 class: 239 subclass: 2 Manufacturer: Sartorius libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=16 bEndpointAddress 0x85 4 0 5b 0 0 0 bEndpointAddress 0x85 4 0 0 0 0 0

here is the result of lsusb -v :

pi@raspberrypi:~/Downloads/usbscale $ lsusb -v

Bus 001 Device 006: ID 24bc:0011
Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 ? bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x24bc idProduct 0x0011 bcdDevice 1.00 iManufacturer 1 iProduct 2 iSerial 3 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 57 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.00 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 63 Report Descriptors: UNAVAILABLE Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x85 EP 5 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 10 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1

Thanks for all the help in advance!

seacuello commented 7 years ago

some additional info hope it helps:

here is my 50-usb-scales.rules file:

SUBSYSTEM=="usb", ATTR{idVendor}=="1446", ATTR{idProduct}=="6a73", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="7b7c", ATTR{idProduct}=="0100", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="2474", ATTR{idProduct}=="0550", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="2474", ATTR{idProduct}=="3550", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="0eb8", ATTR{idProduct}=="f000", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="6096", ATTR{idProduct}=="0158", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="0b67", ATTR{idProduct}=="555e", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="0922", ATTR{idProduct}=="8004", MODE="0776" SUBSYSTEM=="usb", ATTR{idVendor}=="0x24bc", ATTR{idProduct}=="0x0011", MODE="0776"

and the scales.h file:

// // scales.h // ======== // // This file is a list of all currently-recognized scales' vendor and product // IDs. // // For example, the USB product 1446:6173 becomes {0x1446, 0x6173} //

include

// // NSCALES should be kept updated with the length of the list. //

define NSCALES 9

// // What is the number of the weighing result to show, as the first result may be incorrect (from the previous weighing) //

define WEIGH_COUNT 2

// // Scales // ------ // uint16_t scales[NSCALES][2] = {\ // Stamps.com Model 510 5LB Scale {0x1446, 0x6a73}, // USPS (Elane) PS311 "XM Elane Elane UParcel 30lb" {0x7b7c, 0x0100}, // Stamps.com Stainless Steel 5 lb. Digital Scale {0x2474, 0x0550}, // Stamps.com Stainless Steel 35 lb. Digital Scale {0x2474, 0x3550}, // Mettler Toledo {0x0eb8, 0xf000}, // SANFORD Dymo 10 lb USB Postal Scale {0x6096, 0x0158}, // Fairbanks Scales SCB-R9000 {0x0b67, 0x555e}, // Dymo-CoStar Corp. M25 Digital Postal Scale {0x0922, 0x8004}, // Satorius Practium 313-1S {0x24bc, 0x0011} };

sanmai commented 7 years ago

Can you read the data from it directly?

Try this simplified program: https://github.com/sanmai/usb-scale-reader/tree/master/example

seacuello commented 7 years ago

@sanmai - what do you mean by read directly? it does detect the new scale type if that is what you mean. I'm not too familar with php, but will take a look at what you have linked to. Thanks!

sanmai commented 7 years ago

There's a simple C program. Run make to build it, run it and follow directions.

If it could read weight from your device, neither this will. Otherwise there will be opportunity for PR.

On 14 Jul 2017, at 15:43, seacuello notifications@github.com wrote:

@sanmai - what do you mean by read directly? it does detect the new scale type if that is what you mean. I'm not too familar with php, but will take a look at what you have linked to. Thanks!

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

seacuello commented 7 years ago

@sanmai - what does PR mean? i'll work on both codes tangentially and open an issue separately.

erjiang commented 7 years ago

When you plug in the scale, if it is HID (as it should be if it's standard), then you'll see a new /dev/hidraw file. Then try sudo cat /dev/hidraw4 or whatever it's called. When you put stuff on the scale it should print out gibberish (the raw data). If you can't get even this, then something is wrong.

seacuello commented 7 years ago

@erjiang After unpluggging all USBs and replugging the scale I found that it is hidraw0. I then tried sudo cat /dev/hidraw4 and placed items on the scale but saw no output on the terminal just seemed to stall.

seacuello commented 7 years ago

Here is the output I'm getting from 'sudo ./usbscale /dev/hidraw0' :

pi@raspberrypi:~/Downloads/usbscale $ sudo ./usbscale /dev/hidraw0 Found scale 24bc:0011 (bus 1, device 10) It has descriptors: manufc: 1 prodct: 2 serial: 3 class: 239 subclass: 2 Manufacturer: Sartorius libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=16 bEndpointAddress 0x85 Error in USB transfer

erjiang commented 7 years ago

Hopefully you ran sudo cat /dev/hidraw0 as opposed to sudo cat /dev/hidraw4 as you wrote? If cat did not get you any data, then it suggests that your scale does not follow the USB HID standard for scales, and thus isn't compatible with this program.

seacuello commented 7 years ago

Yes I was able to get the gibberish from the scale using the sudo cat /dev/hidraw0.. Once i got that I tried to run the ./usbscale again and recieved the following:

pi@raspberrypi:~/Downloads/usbscale $ sudo ./usbscale /dev/hidraw0 Found scale 24bc:0011 (bus 1, device 16) It has descriptors: manufc: 1 prodct: 2 serial: 3 class: 239 subclass: 2 Manufacturer: Sartorius libusb: error [submit_bulk_transfer] submiturb failed error -1 errno=16 bEndpointAddress 0x85 4 0 5c 0 0 0 bEndpointAddress 0x85 4 0 0 0 0 0

erjiang commented 7 years ago

@seacuello If you were able to get that gibberish using cat, try recording some sample data using xxd and posting it here.

  1. Run sudo cat /dev/hidraw0 | xxd | tee myoutput.txt
  2. Put something on the scale and watch some data appear on-screen.
  3. Ctrl-C
  4. Post myoutput.txt here.

Have you checked with the scale's manufacturer to see what protocol(s) they actually support? Maybe the USB is for another purpose?

seacuello commented 7 years ago

@erjiang - Thanks for your help, and yes I do have a help call into the manufacturer of the scale and will share any useful info they give me.

As for sudo cat /dev/hidraw0 | xxd | tee myoutput.txt .. Here is the output not sure if it is what we were looking for :

pi@raspberrypi:~/Downloads/usbscale $ sudo cat /dev/hidraw0 | xxd | tee myoutput.txt tee: myoutput.txt: Permission denied 0000000: 0400 5f00 0000 0000 0400 0000 0000 0000 .._............. 0000010: 0400 5900 0000 0000 0400 0000 0000 0000 ..Y............. 0000020: 0000 0000 0000 0000 0000 2c00 0000 0000 ..........,..... 0000030: 0000 0000 0000 0000 0000 2c00 0000 0000 ..........,..... 0000040: 0000 0000 0000 0000 0000 2c00 0000 0000 ..........,..... 0000050: 0000 0000 0000 0000 0000 2c00 0000 0000 ..........,..... 0000060: 0000 0000 0000 0000 0000 2c00 0000 0000 ..........,..... 0000070: 0000 0000 0000 0000 0400 5c00 0000 0000 ............... 0000080: 0400 0000 0000 0000 0400 5b00 0000 0000 ..........[..... 0000090: 0400 0000 0000 0000 0000 0000 0000 0000 ................ 00000a0: 0000 2c00 0000 0000 0000 0000 0000 0000 ..,............. 00000b0: 0000 2c00 0000 0000 0000 0000 0000 0000 ..,............. 00000c0: 0000 1e00 0000 0000 0000 0000 0000 0000 ................ 00000d0: 0000 1e00 0000 0000 0000 0000 0000 0000 ................ 00000e0: 0000 2400 0000 0000 0000 0000 0000 0000 ..$............. 00000f0: 0400 5c00 0000 0000 0400 0000 0000 0000 ............... 0000100: 0400 5e00 0000 0000 0400 0000 0000 0000 ..^............. 0000110: 0000 0000 0000 0000 0000 2400 0000 0000 ..........$..... 0000120: 0000 0000 0000 0000 0000 2100 0000 0000 ..........!..... 0000130: 0000 0000 0000 0000 0000 2700 0000 0000 ..........'..... 0000140: 0000 0000 0000 0000 0000 2c00 0000 0000 ..........,..... 0000150: 0000 0000 0000 0000 0400 5900 0000 0000 ..........Y..... 0000160: 0400 0000 0000 0000 0400 6200 0000 0000 ..........b.....

erjiang commented 7 years ago

That doesn't look like the protocol that usbscale reads. Maybe your scale has its own custom protocol?

Unfortunately there are no plans to add custom protocols to this software right now... any time spent on usbscale in the near future ideally goes towards shoring up support for the standard protocol since even that's rather incomplete.

erjiang commented 1 year ago

Closing issue - seems to be a non-standard scale.